using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static string InputPattern = "InputX";
static IEnumerable<string> GetInputEnum()
{
if (InputPattern == "Input1") {
yield return "10";
yield return "...*....**";
yield return "..........";
yield return "**....**..";
yield return "........*.";
yield return "..*.......";
yield return "..........";
yield return ".*........";
yield return "..........";
yield return "....*..***";
yield return ".*....*...";
yield return "10";
yield return "****.*****";
yield return "*..*.*....";
yield return "****.*....";
yield return "*....*....";
yield return "*....*****";
yield return "..........";
yield return "****.*****";
yield return "*..*...*..";
yield return "****...*..";
yield return "*..*...*..";
yield return "0";
//5
//3
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) yield return wkStr;
}
}
static int UB;
static void Main()
{
IEnumerable<string> InputEnum = GetInputEnum();
int CurrY = -1;
char[,] BanArr = null;
foreach (string EachStr in InputEnum) {
if (CurrY == -1) {
int n = int.Parse(EachStr);
if (n == 0) return;
UB = n - 1;
CurrY = 0;
BanArr = new char[UB + 1, UB + 1];
continue;
}
for (int X = 0; X <= UB; X++) {
BanArr[X, CurrY] = EachStr[X];
}
if (++CurrY > UB) {
EachSolve(BanArr);
CurrY = -1;
}
}
}
static void EachSolve(char[,] pBanArr)
{
int[,] CntArr = new int[UB + 1, UB + 1];
Func<int, int, int> wkFunc = (pX, pY) =>
{
if (pX < 0 || UB < pX) return 0;
if (pY < 0 || UB < pY) return 0;
return CntArr[pX, pY];
};
for (int LoopX = 0; LoopX <= UB; LoopX++) {
for (int LoopY = 0; LoopY <= UB; LoopY++) {
if (pBanArr[LoopX, LoopY] == '*') //印のついているマスの場合
CntArr[LoopX, LoopY] = 0;
else {
int Cnt1 = wkFunc(LoopX - 1, LoopY - 1);
int Cnt2 = wkFunc(LoopX, LoopY - 1);
int Cnt3 = wkFunc(LoopX - 1, LoopY);
int wkMin = Math.Min(Cnt1, Cnt2);
wkMin = Math.Min(wkMin, Cnt3);
CntArr[LoopX, LoopY] = wkMin + 1;
}
}
}
Console.WriteLine(CntArr.Cast<int>().Max());
}
}