#注意这里不要自以为是偷懒写n-3,m-3,还是写完range(m),range(n),让程序去判断,自以为是可能漏掉一些情况。
f=open("C:\\Users\\zzl261004\\Desktop\\2020.txt","r")
arr=f.readlines()
for i in range(len(arr)):
temp=arr[i].strip()
arr[i]=list(temp)
ans=0
m=len(arr)
n=len(arr[0])
for i in range(m):
for j in range(n):#注意这里不要自以为是偷懒写n-3,m-3
if 0<=j+3<=n-1:
if arr[i][j]=="2" and arr[i][j+1]=="0" and arr[i][j+2]=="2" and arr[i][j+3]=="0":
ans+=1
if 0<=i+3<=n-1:
if arr[i][j]=="2" and arr[i+1][j]=="0" and arr[i+2][j]=="2" and arr[i+3][j]=="0":
ans+=1
for i in range(m):
for j in range(n):
if 0<=i+3<=m-1 and 0<=j+3<=n-1:
if arr[i][j]=="2" and arr[i+1][j+1]=="0" and arr[i+2][j+2]=="2" and arr[i+3][j+3]=="0":
ans+=1
print(ans)