#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(void) {
	vector<string> in;
	int n;
	int top, bottom, middle;

	while(cin >> n, n) {
		in.clear();
		for(int i = 0; i < n; i++) {
			string str;
			cin >> str;
			in.push_back(str);
		}

		top = in.size() - 1;
		bottom = 0;

		while(top > bottom) {
			bool flag;
			middle = (top + bottom) / 2 + (top + bottom) % 2;

			for(int i = 0; i < n - middle; i++) {
				for(int j = 0; j < n - middle; j++) {
					flag = true;
					for(int k = 0; k < middle; k++) {
						for(int l = 0; l < middle; l++) {
							if(in[i + k][j + l] != '.') {
								k = l = middle;
								flag = false;
							}
						}
					}
					if(flag) {
						bottom = middle;
						i = j = n - middle;
					}
				}
			}

			if(!flag) {
				top = middle - 1;
			}
		}
		cout << top << endl;
	}
}