#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<complex>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
#define M 310
#define N 620
ll h,w;
string s[N];
bool t[N][N];

ll cs[N][N];
void Init(){
    lol(i,N-1){
	cs[i][0]=0;
	lol(j,N-1)cs[i][j+1]=cs[i][j]+t[i][j];
    }
}
ll Sum(ll y,ll a,ll b){
    if(y<0||y>=N)return 0;
    return cs[y][b+1]-cs[y][a];
}
ll Solve(){
    lol(i,N)for(int j=i+1;j<N;j++)swap(t[i][j],t[j][i]);
    Init();//cout<<"%"<<endl;
    ll ans=0;
    lol(i,N-1){
	lol(a,N)for(int b=a+1;b<N-1;b++){
	    if(!(t[i][a]==1&&t[i][b]==1))continue;
	    ll d=b-a;
	    ans+=Sum(i-d,a,b);
	    ans+=Sum(i+d,a,b);
	}
    }
    return ans;
}


int main(){
    cin>>h>>w;
    lol(i,h)cin>>s[i];
    lol(i,N)lol(j,N)t[i][j]=0;
    lol(i,h)lol(j,w){
	if(s[i][j]=='.')continue;
	t[i-j+M][i+j]=1;
    }
    ll ans=Solve()+Solve();//cout<<ans<<endl;
    lol(i,N)lol(j,N){if(t[i][j]==0)continue;
	lol(k,N){
	    if(i==k)continue;
	    if(t[k][j]==0)continue;
	    ll d=abs(i-k);
	    if(j-d>=0)if(t[i][j-d]==1)ans--;
	    if(j+d<N)if(t[i][j+d]==1)ans--;
	}
    }
    cout<<ans<<endl;
    return 0;
}
