0
//AC
#define _CRT_SECURE_NO_WARNINGS
#include
#define MAXN 55
char matrix[MAXN][MAXN];
int visit[MAXN][MAXN];
int N = 0;
int dir[4][2] = { { -1, 0 }, {1,0}, {0,1}, {0,-1} };
void init()
{
int i = 0;
int j = 0;
for (i = 0; i < MAXN;i++)
{
for (j = 0; j < MAXN; j++)
{
matrix[i][j] = '\0';
visit[i][j] = 0;
}
}
return ;
}
int findnum(int x, int y, int ops)
{
int num = 0;
int index = 1;
int x1 = 0;
int y1 = 0;
switch (ops)
{
//往上找,就是横坐标变小
case 1:
{
while (1)
{
x1 = x - index;
y1 = y;
if ((x1<1) || (x1>N) || (y1<0) || (y1>=N)) return num;
if ('o' == matrix[x1][y1]) return num;
//找两边有没有#
if ((x1 >= 1) && (x1 <= N) && ((y1-1) >= 0) && ((y1-1) < N))
{
if ('#' == matrix[x1][y1 - 1]) return num;
}
if ((x1 >= 1) && (x1 <= N) && ((y1 + 1) >= 0) && ((y1 + 1) < N))
{
if ('#' == matrix[x1][y1 + 1]) return num;
}
num += 1;
index += 1;
}
}
break;
case 2:
{
while (1)
{
x1 = x + index;
y1 = y;
if ((x1<1) || (x1>N) || (y1<0) || (y1 >= N)) return num;
if ('o' == matrix[x1][y1]) return num;
//找两边有没有#
if ((x1 >= 1) && (x1 <= N) && ((y1 - 1) >= 0) && ((y1 - 1) < N))
{
if ('#' == matrix[x1][y1 - 1]) return num;
}
if ((x1 >= 1) && (x1 <= N) && ((y1 + 1) >= 0) && ((y1 + 1) < N))
{
if ('#' == matrix[x1][y1 + 1]) return num;
}
num += 1;
index += 1;
}
}
break;
case 3:
{
while (1)
{
x1 = x ;
y1 = y - index;
if ((x1<1) || (x1>N) || (y1<0) || (y1 >= N)) return num;
if ('o' == matrix[x1][y1]) return num;
//找两边有没有#
if (((x1 - 1) >= 1) && ((x1 - 1) <= N) && (y1 >= 0) && (y1 < N))
{
if ('#' == matrix[x1-1][y1]) return num;
}
if (((x1 + 1) >= 1) && ((x1 + 1) <= N) && (y1 >= 0) && (y1 < N))
{
if ('#' == matrix[x1+1][y1]) return num;
}
num += 1;
index += 1;
}
}
break;
case 4:
{
while (1)
{
x1 = x;
y1 = y + index;
if ((x1<1) || (x1>N) || (y1<0) || (y1 >= N)) return num;
if ('o' == matrix[x1][y1]) return num;
//找两边有没有#
if (((x1 - 1) >= 1) && ((x1 - 1) <= N) && (y1 >= 0) && (y1 < N))
{
if ('#' == matrix[x1 - 1][y1]) return num;
}
if (((x1 + 1) >= 1) && ((x1 + 1) <= N) && (y1 >= 0) && (y1 < N))
{
if ('#' == matrix[x1 + 1][y1]) return num;
}
num += 1;
index += 1;
}
}
break;
default:
break;
}
return num;
}
int findcross()
{
int ans = 0;
int i = 0;
int j = 0;
int k = 0;
int num1 = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
//找cross的中心,最少也要从第2行开始,第1列也不可能
for (i = 2; i <= N;i++)
{
for (j = 1; j < N; j++)
{
if ('o' == matrix[i][j]) continue;
if (1 == visit[i][j]) continue;
//找四个方向是否有相同的个数的#,如果有,找有没有相邻的#
//往上找,就是横坐标变小
num1 = findnum(i, j, 1);
if (0 == num1) continue;
//向下找,横坐标变大
num2 = findnum(i, j, 2);
if (num1 != num2) continue;
//向左找,纵坐标变小
num3 = findnum(i, j, 3);
if (num1 != num3) continue;
//向右找,纵坐标变大
num4 = findnum(i, j, 4);
if (num1 != num4) continue;
//有十字,设置已用过的#,下次就不用了
ans += 1;
}
}
return ans;
}
int main()
{
//寻找以这个点为中心找
int i = 0;
int ans = 0;
freopen("input.txt","r",stdin);
while (scanf("%d",&N) &&(0 != N))
{
init();
for (i = 1; i <= N; i++)
{
scanf("%s", matrix[i]);
}
ans = findcross();
printf("%d\n", ans);
}
return 0;
}