#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int MAX_N = 1005;

int N, E[MAX_N][MAX_N], V[MAX_N][MAX_N], f = 0;

void init(){
  memset(E, 0, sizeof(E));
  E[0][0] = V[0][0];
  FOR(i, 1, N) E[i][0] = E[i - 1][0] + V[i][0];
  FOR(i, 1, N) E[0][i] = E[0][i - 1] + V[0][i];
  FOR(y, 1, N)
    FOR(x, 1, N)
    E[y][x] = V[y][x] + E[y - 1][x] + E[y][x - 1] - E[y - 1][x - 1];
}

bool check(int Y1, int X1, int Y2, int X2){
  int cnt = E[Y2][X2];
  if(X1 - 1 >= 0) cnt -= E[Y2][X1 - 1];
  if(Y1 - 1 >= 0) cnt -= E[Y1 - 1][X2];
  if(X1 - 1 >= 0 && Y1 - 1 >= 0) cnt += E[Y1 - 1][X1 - 1];
  return (cnt == 0 ? true : false);
}

int solve(){
    for(int i = N - 1; i > 0; --i) REP(y, N - i) REP(x, N - i) if(check(y, x, y + i, x + i)) return i + 1;
    return (int)f;
}

int main() {
  while(scanf("%d", &N) && N){
    f = 0;
    REP(i, N){
      string s; cin >>s;
      REP(j, s.length()){
        V[i][j] = (s[j] == '*' ? 1 : 0);
        if(V[i][j] == 0) f = 1;
      }
    }
    init();
    cout <<solve() <<endl;
  }
  return 0;
}