import std.stdio : write, writeln, writefln, stdin;
import std.array;
import std.range;
import std.typecons;
import std.algorithm : max, min;

void main(){
	while(true){
		int n = next!int();
		if(n==0){ break; }
		
		bool[][] m;
		int[][] d;
		foreach(i; n.iota){
			bool[] l;
			foreach(c; next!string()){
				l ~= c=='.';
			}
			m ~= l;
			
			d ~= repeat(0).take(n).array;
		}
		
		for(int x=0; x<n; ++x){
			if(m[0][x]){
				++d[0][x];
			}
		}
		for(int y=0; y<n; ++y){
			if(m[y][0]){
				++d[y][0];
			}
		}
		
		int max_;
		for(int y=1; y<n; ++y){
			for(int x=1; x<n; ++x){
				if(m[y][x]){
					int min_ = int.max;
					const ofs = [[-1,0], [-1,-1], [0,-1]];
					foreach(p; ofs){
						min_ = min(min_, d[y+p[1]][x+p[0]]);
					}
					d[y][x] = min_+1;
					max_ = max(max_, d[y][x]);
				}
			}
		}
		
		writeln = max_;
	}
}


import std.stdio : readln, chomp;
import std.conv : to;
import std.string : split;
shared string[] input;
shared string delim = " ";
T next(T)()
in
{
	assert(hasNext());
}
out
{
	input.popFront;
}
body
{
	return input.front.to!T;
}

void next(T)(ref T v){
	v = next!T();
}

bool hasNext(){
	if(input.length > 0){
		return true;
	}
	
	string str = readln;
	if(str.length > 0){
		input ~= str.chomp.split(delim);
		return true;
	}else{
		return false;
	}
}


void dbg(T...)(T vs)
{
	import std.stdio : stderr;
	foreach(v; vs)
		stderr.write(v.to!string ~ " ");
	stderr.write("\n");
}

T clone(T)(T v){
	T v_;
	static if(isInputRange!(T)){
		foreach(ite; v){
			v_ ~= ite.clone;
		}
	}else{
		v_ = v;
	}
	
	return v_;
}