#include<iostream>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
const int NMAX = 1024;
bool Map[NMAX][NMAX];
int sum[NMAX + 1][NMAX + 1];

void init(int n) {
  REP(y, n) {
    REP(x, n) {
      sum[x][y] = 0;
    }
  }
}

void accumulate(int n) {
  for (int y = 1; y <= n; y++) {
    for (int x = 1; x <= n; x++) {
      sum[x][y] = sum[x-1][y] + sum[x][y-1] - sum[x-1][y-1]
        + (Map[x-1][y-1] ? 1 : 0);
    }
  }
}

int asterisks(int xa, int ya, int xb, int yb) {
  xa++; ya++; xb++; yb++;
  return sum[xb][yb] - sum[xa-1][yb] - sum[xb][ya-1] 
    + sum[xa-1][ya-1];
}

bool contains_square(int n, int size) {
  if (size > n) return false;
  size--;
  REP(y, n - size) {
    REP(x, n - size) {
      if (!asterisks(x, y, x + size, y + size)) return true;
    }
  }
  return false;
}

int solve(int n) {
  if (not contains_square(n, 1)) return 0;
  int lb = 1, ub = n + 1;
  while (ub - lb > 1) {
    int mid = (lb + ub) / 2;
    if (contains_square(n, mid)) {
      lb = mid;
    } else {
      ub = mid;
    }
  }
  return lb;
}

int main() {
  int n;
  while (cin >> n and n) {
    init(n);
    REP(y, n) {
      string row;
      cin >> row;
      REP(x, n) {
        Map[x][y] = (row[x] == '*');
      }
    }
    accumulate(n);

    cout << solve(n) << endl;
  }
}