import qualified Data.IntMap.Strict as M
import Data.List
import Data.Maybe

main = interact $ unlines . unfoldr main' . lines
 where
  main' (n':xs)
   | n' == "0" = Nothing
   | otherwise = return (show (square_searching n m), xs')
   where
    (m',xs') = splitAt n xs
    n = read n'
    m = map fst . filter ((=='.').snd) $ zip [0..] $ concat m'

square_searching :: Int -> [Int] -> Int
square_searching n m
 | null m = 0
 | otherwise = maximum $ M.elems (foldl' (dp n) M.empty m)

dp :: Int -> M.IntMap Int -> Int -> M.IntMap Int
dp n m i = M.insert i (if mod i n == 0 then 1 else v+1) m
 where v = minimum $ map (\k -> M.findWithDefault 0 k m) [i-1,i-n,i-n-1]