#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int n;
char f[1005][1005];
int imos[1005][1005];
int culc(int i,int j,int x)
{
	if(i-x<0||j-x<0)return 0;
	return imos[i][j]-imos[i][j-x]-imos[i-x][j]+imos[i-x][j-x];
}
int main()
{
	int cas=0;
	while(1)
	{
		cas++;
		int ans=0;
		cin >> n;
		if(n==0)break;
		memset(imos,0,sizeof(imos));
		memset(f,0,sizeof(f));
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=n;j++)
			{
				cin >> f[i][j];
				if(f[i][j]=='.')imos[i][j]++;
			}
		}
		for(int i=1;i<=n;i++)
		{
			for(int j=2;j<=n;j++)
			{
				imos[j][i]+=imos[j-1][i];
			}
		}
		for(int i=1;i<=n;i++)
		{
			for(int j=2;j<=n;j++)
			{
				imos[i][j]+=imos[i][j-1];
			}
		}
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=n;j++)
			{
				int l=ans,r=n+1;
				while(r-l>1)
				{
					int mid=(l+r)/2;
					if(culc(i,j,mid)==mid*mid)l=mid;
					else r=mid;
				}
				ans=max(ans,l);
			}
		}
		cout << ans << endl;
	}
	return 0;
}