#include <cstdio>
#include <cstring>
signed main(){
short x,y,ans=0;
char map[505][505];
scanf("%hd%hd\n",&x,&y);
memset(map,' ',sizeof(map));
for (short i=1;i<=x;i++,getchar())
for (short j=1;j<=y;j++)
map[i][j] = getchar();
for (short i=1;i<=x;i++)
for (short j=1;j<=y;j++)
if (map[i][j] == '0' && map[i-1][j] == '*' && map[i+1][j] == '*' && map[i][j-1] == '*' && map[i][j+1] == '*')
ans++;
printf("%hd",ans);
return 0;
}