N=int(input()) S=[list(input()) for i in range(N)] ans=0 def dfs(i,j,cur): global ans if i==j==N-1: ans+=cur[::-1]==cur return if i