import os
import sys
# 请在此输入您的代码
sys.setrecursionlimit(60000)
n = int(input())
dao = []
for _ in range(n):
tmp = list(input())
dao.append(tmp)
dict = [(1, 0), (0, 1), (-1, 0), (0, -1)]
used = [[0 for _ in range(n)] for _ in range(n)]
def dfs(x, y):
global flag
# used[x][y] = 1
if dao[x][y - 1] == "#" and dao[x][y + 1] == "#" and dao[x + 1][y] == "#" and dao[x - 1][y] == "#":
flag = 1
used[x][y] = 1
for x1, y1 in dict:
a = x + x1
b = y + y1
if not used[a][b] and dao[a][b]=="#":
dfs(a, b)
cnt = 0
for i in range(n):
for j in range(n):
if dao[i][j] == "#" and not used[i][j]:
flag = 0
dfs(i, j)
if not flag:
cnt += 1
print(cnt)