#include<bits/stdc++.h>
using namespace std;
int n,m;
char mapp[2010][2010];
long long ans;
int main(){
cin>>n>>m;
for(int i=0;i<=n+1;i++)
for(int j=0;j<=m+1;j++)
mapp[i][j]='.';
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
cin>>mapp[i][j];
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(mapp[i][j]'*'&&mapp[i][j-1]'.'&&mapp[i-1][j]'.'){
int hide=1,tall=1,hide2=1;
for(int k=1;;k++){
if(mapp[i][j+k]''){
if(mapp[i+1][j+k]'.'&&mapp[i-1][j+k]'.')
hide++;
}else break;
}
if(mapp[i][j+hide]=='') continue;
for(int k=1;;k++){
if(mapp[i+k][j]'*'){
if(mapp[i+k][j+1]'.'&&mapp[i+k][j-1]'.')
tall++;
}else break;
}
if(mapp[i+tall][j-1]'') tall--;
if(mapp[i+tall+1][j]=='') continue;
for(int k=1;;k++){
if(mapp[i+tall][j+k]'*'){
if(mapp[i+1+tall][j+k]'.'&&mapp[i-1+tall][j+k]'.')
hide2++;
}else break;
}
if(mapp[i+tall][j+hide2]'') continue;
if(hide2hide&&hide>=2&&tall>=2){
// cout<<i<<" "<<j<<" "<<hide<<" "<<hide2<<" "<<tall<<"\n";
int tmp=0;
for(int k=1;k<tall;k++){
for(int t=1;t<hide;t++){
if(mapp[i+k][j+t]'') tmp=1;
}
}
if(tmp==0) ans++;
tmp=0;
}
}
}
}
cout<<ans;
return 0;
}