#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdlib>
using namespace std;

#define ull unsigned long long
#define ll long long
#define rep(i,j) for(int i=0;i<j;++i)
#define loop(i,a,j) for(int i=a;i<j;++i)
#define mpi(it,table,T,E) for(map<T,E>::iterator it = table.begin();it!=table.end();++it)
#define PI 3.141592654
/*
   ifstream fin("input.txt");
   ofstream fout("output.txt");
#define cin fin
#define cout fout
 */
char graph[1001][1001];
bool visited[1001][1001];
int maxi;
int k;

void solve(){
	rep(i,k){
		rep(j,k){
			if(graph[i][j] == '.' && !visited[i][j]){
				queue<int> xx;
				queue<int> yy;
				queue<int> lvl;
				xx.push(i);
				yy.push(j);
				lvl.push(2);
				bool flag = true;
				int tmp = 0;
				while(flag && xx.size()>0){
					int r = 2*tmp + 1;
					if(xx.size() < r)break;
					vector<pair<int,int> > vis;
					//evaluate
					rep(w,r){
						int x = xx.front() , y = yy.front() , type = lvl.front();
						xx.pop();yy.pop();lvl.pop();
						vis.push_back(make_pair(x,y));
						if(graph[x][y] == '*'){
							flag = false;
							break;
						}
						if(type == 2){
							if( x + 0 < k && y + 1 < k ){
								xx.push(x+0);
								yy.push(y+1);
								lvl.push(0);
							}
							if( x + 1 < k && y + 1 < k ){
								xx.push(x+1);
								yy.push(y+1);
								lvl.push(2);
							}
							if( x + 1 < k && y + 0 < k ){
								xx.push(x+1);
								yy.push(y+0);
								lvl.push(1);
							}
						}else if(type == 1){
							if( x + 1 < k && y + 0 < k ){
								xx.push(x+1);
								yy.push(y+0);
								lvl.push(1);
							}
						}else{
							if( x + 0 < k && y + 1 < k ){
								xx.push(x+0);
								yy.push(y+1);
								lvl.push(0);
							}
						}
					}

					if(flag){
						tmp++;
						rep(w,r){
							//cout<<vis[w].first<<":"<<vis[w].second<<endl;
							//visited[vis[w].first][vis[w].second] = true;
						}
					}
				}
				//cout<<"$$$$$$$$$$$$$$$$$$$"<<endl;
				maxi = max(maxi,tmp);
			}
		}
	}
}

int main(){
	while(scanf("%d",&k),k){
		memset(graph,'*',sizeof(graph));
		memset(visited,0,sizeof(visited));
		maxi = 0;
		rep(i,k){
			scanf("%s",&graph[i]);
		}
		solve();
		/*rep(i,k){
		  rep(j,k){
		  cout<<visited[i][j]<<" ";
		  }
		  cout<<endl;
		  }*/
		printf("%d\n",maxi);
	}
	return 0;
}