module Main where import Data.Array.Unboxed import Input main :: IO () main = do inp <- getInput 10 let h = length inp w = length (head inp) arr = listArray ((0, 0), (w-1, h-1)) (concatMap (map (== '#')) inp) :: UArray (Int, Int) Bool asts = map fst (filter snd (assocs arr)) sight (a,b) (x,y) = let dx = (x - a) `div` g dy = (y - b) `div` g g = gcd (abs (x - a)) (abs (y - b)) pts = [(a + i * dx, b + i * dy) | i <- [1..g-1]] in all (not . (arr !)) pts numVisible p = length (filter (\q -> q /= p && sight p q) asts) print (maximum (map numVisible asts))