#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int H, W, max_;

	while (true)
	{
		max_ = 0;

		scanf("%d", &H);
		
		W = H;

		if (H == 0 && W == 0) { break; }

		vector<vector<char> > c(H, vector<char>(W));

		vector<vector<int> > dp(H, vector<int>(W, 0));

		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < W; j++)
			{
				scanf("%c", &c[i][j]);

				if (c[i][j] == '.')
				{
					if (i == 0 || j == 0)
					{
						dp[i][j] = 1;
					}

					max_ = 1;
				}
			}
		}

		for (int i = 1; i < H; i++)
		{
			for (int j = 1; j < W; j++)
			{
				if (c[i][j] == 0)
				{
					dp[i][j] = min({ dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1] }) + 1;

					max_ = max(dp[i][j], max_);
				}
			}
		}

		printf("%d\n", max_ * max_);
	}

	return 0;
}