#include <iostream>
using namespace std;

int main ()
{
    int N;
    while (cin >> N, N) {
        char v[N][N+1];
        int d[N][N];
        for (int i = 0; i < N; i++) {
                cin >> v[i];
                for (int j = 0; j < N; j++)
                    d[i][j] = 1;
        }

        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N-1; j++) {
                if (v[i][j] == '*') d[i][j] = 0;
                else if (v[i][j] == v[i][j+1]) {
                    d[i][j+1] += d[i][j];
                }
            }
        }

        int res = 0;
        for (int i = 0; i < N; i++) {
            int tmp = res;
            for (int j = 0; j < N; j++) {
                if (res < d[i][j]) {
                    int t = d[i][j];
                    for (int k = 0; k < t; k++) {
                        if (d[i+k][j] < t) t = d[i+k][j];
                    }
                    if (t > res) res = t;
                }
            }
        }

        cout << res << endl;
    }

    return 0;
}