//C++11

#include <iostream>
#include <string>

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)

const int MAXN = 1000;
int n;
bool mat[MAXN][MAXN];

int solve(void)
{
    //all filled
    bool filled = true;
    REP(i,n){ REP(j,n){ 
        if(!mat[i][j]){ 
            filled = false;
            break;
        }
    }}
    if(filled) return 0;
    //search
    for(int l=n;l>=1;l--){
        for(int i0=0;i0<=n-l;i0++){
            int i1 = 0;
            for(int j0=0;j0<=n-l;j0++){
                bool found = true;
                for(int i=i0+l-1;i>=i0;i--){
                for(int j=j0+l-1;j>=j0;j--){
                    if(mat[i][j]){
                        found = false;
                        if(i>i1) i1 = i;
                        j0 = j;
                        goto endofloop;
                    }
                }}
                endofloop:
                if(found) return l;
            }
            if(i1>i0) i0 = i1;
        }
    }
    return 0;
}

int main(void)
{
    while(true){
        //read
        cin >> n;
        if(!n) break;
        REP(j,n){ 
            string s;
            cin >> s;
            REP(i,n) mat[i][j] = (s[i]=='*') ? true : false;
        }
        //solve and print
        int res = solve();
        cout << res << endl;
    }
    return 0;
}