#include <iostream>

using namespace std;

#define MAX_SIZE 1000

int return_size(char data[MAX_SIZE][MAX_SIZE],int, int);

int square_size;
int data_size;

int main(){

    int i, j;
    char data[MAX_SIZE][MAX_SIZE], cell;

    while(1){
        cin >> data_size;
        if(data_size == 0) break;
        square_size = 1;

        for(i = 0;i < data_size; i++){
            for(j = 0;j < data_size;j++){
             cin >> cell;
             data[i][j] = cell;
          }
        }

       for(i = 0;i < data_size; i++){
            for(j = 0;j < data_size;j++){
                return_size(data, i, j);
                //cout << "x: " << i << "y: " << j << "size: " << return_size(data, i, j) << endl;
             }
        }
          if(square_size == data_size) cout << 0 << endl;
          else cout << square_size << endl;
    }
}

int return_size(char data[MAX_SIZE][MAX_SIZE],int x, int y){
    int i, j;
    if(x+square_size > data_size) return -1;
    if(data[x][y] == '.' && data[x+square_size][y] == '.' && data[x][y+square_size] == '.' && data[x+square_size][y+square_size]){
         for(i = x;i < x+square_size; i++){
             for(j = y; j < y+square_size; j++){
                if(data[i][j] != '.')return square_size;
             }
         }
         square_size++;
         return_size(data, x, y);
    }
    return -1;
}