import Control.Applicative ((<$>))
import Control.Monad (unless, when, forM_, foldM)
import Data.Vector.Unboxed.Mutable (IOVector)
import qualified Data.Vector.Unboxed.Mutable as VM

main :: IO ()
main = do
  n <- readLn
  unless (n == 0) $ do
    solve n >>= print
    main

solve :: Int -> IO Int
solve n = do
  dp <- VM.replicate (n^2 + 2 * n + 1) 0
  forM_ [0 .. n-1] $ \i -> do
    s <- getLine
    forM_ [0 .. n-1] $ \j -> do
      when (s !! j == '.') $ do
        VM.write dp (idx i j) (-1)
  forM_ [idx i j | i <- [0 .. n-1], j <- [0 .. n-1]] $ \k -> do
    v <- VM.read dp k
    when (v == (-1)) $ do
      x <- VM.read dp (k-1)
      y <- VM.read dp (k-n-1)
      z <- VM.read dp (k-n-2)
      VM.write dp k (minimum [x, y, z] + 1)
  foldM (\v k -> VM.read dp k >>= \u -> return (max v u)) 0 [idx i j | i <- [0 .. n-1], j <- [0 .. n-1]]
  where idx i j = (n+1)*(i+1)+j+1

