#include<bits/stdc++.h>
using namespace std;
char a[205][205];
int n,ans=0,more_ans=0;
int main(){
cin >> n;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
cin >> a[i][j] ;
for(int i=1;i<n;i++){
for(int j=0;j<n;j++){
if (a[i][j] == '1'){
int poss_big = min(i,n-j);
for (int k=1; k<=poss_big; k+=2){
int r = i-k;
int c = j;
int o_r = i;
int flag = 1;
for (int kk=0;kk<=k;kk++){
if (a[o_r--][c] == '1' && a[r++][c] == '1' ) {
c++;
}else{
flag = 0;
break;
}
}
if (flag == 1) anxs++;
}
}
}
}
for(int i=1;i<n-1;i++){
for(int j=1;j<n-1;j++){
if (a[i][j] == '1'){
int poss_big = min({n-i,i,j,n-j});
for (int k=1; k<=poss_big; k++){
if (a[i-k][j-k]='1'&& a[i-k][j+k]=='1' && a[i+k][j-k]=='1' && a[i+k][j+k]=='1') more_ans++;
else break;
}}}}
cout<<ans + more_ans<<endl;
return 0;
}