#include<iostream>
using namespace std;
int n,ans;
int x1,x2,y1,y2;\\坐标(x分叉)
int a[107][107];
int read(){
register int x=0,f=1;register char ch=cin.get();
while(ch<'0'||ch>'9'){if(ch=='-'){f=-1;}ch=cin.get();}
while(ch>='0'&&ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=cin.get();
return x*f;}
void dfs1(){
while(x1>0&&x2<=n&&y1>0&&y2<=n){
if(a[x1][y1]==1&&a[x1][y2]==1&&a[x2][y1]==1&&a[x2][y2]){
ans++;
}
else return;
x1--;
x2++;
y1--;
y2++;
}
}
void dfs2(int x,int y){
while(x1>0&&x2<=n&&y1>0&&y2<=n){
if(a[x1][y1]==1&&a[x1][y2]==1&&a[x2][y1]==1&&a[x2][y2]){
ans++;
}
else return;
x1--;
x2++;
y1--;
y2++;
}
}
int main(){
ios::sync_with_stdio(false);
cout.tie(0);
n=read();
for(register int i=1;i<=n;i++){
for(register int j=1;j<=n;j++){
a[i][j]=cin.get()-'0';
}
cin.get();
}
for(register int i=1;i<=n;i++)for(register int j=1;j<=n;j++){
if(a[i][j]==1){
x1=i-1,y1=j-1,x2=i+1,y2=j+1;
dfs1();
x1=i,y1=j,x2=i+1,y2=j+1;
if(a[x2][y1]==1&&a[x2][y2]==1&&a[x1][y2]==1){
dfs2(i,j);
}
}
}
cout<<ans;
}