#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

char field[1010][1010];
int sum[1010][1010];

int main() {
  int n;
  while (scanf("%d", &n), n) {
    REP(i, n) {
      scanf("%s", field[i]);
    }
    MEMSET(sum, 0);
    REP(y, n) {
      REP(x, n) {
        sum[y + 1][x + 1] = sum[y + 1][x] + sum[y][x + 1] - sum[y][x];
        if (field[y][x] == '*') {
          sum[y + 1][x + 1]++;
        }
      }
    }
    int ans = 0;
    REP(y, n) {
      REP(x, n) {
        int l = ans;
        int r = min(n - y, n - x);
        while (l < r) {
          int m = (l + r) / 2;
          int nx = x + m;
          int ny = y + m;
          int total = sum[ny][nx] - sum[ny][x] - sum[y][nx] + sum[y][x];
          if (total == 0) {
            ans = m;
            l = m + 1;
          } else {
            r = m;
          }
        }
        int m = l;
        int nx = x + m;
        int ny = y + m;
        int total = sum[ny][nx] - sum[ny][x] - sum[y][nx] + sum[y][x];
        if (total == 0) { ans = max(ans, m); }
      }
    }
    printf("%d\n", ans);
  }
}