#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pr;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 1e18;


int main() { 
	int h,w; cin>>h>>w;
	vector<string> b(h);
	rep(i,0,h) cin>>b[i];
	vector<vector<bool>> coin(h+w);
	rep(i,0,h+w) coin[i].resize(h+w,false);
	vector<vector<int>> sum(h+w);
	rep(i,0,h+w) sum[i].resize(h+w,0);
	rep(i,0,h)rep(j,0,w){
		if(b[i][j]=='#'){
			coin[i+j][i-j+w-1]=true;
			sum[i+j][i-j+w-1]=1;
		}
	}
	h+=w;
	rep(i,0,h)rep(j,0,h){
		if(j!=0) sum[i][j]+=sum[i][j-1];
	}
  	ll ans=0;
	rep(i,0,h)rep(j,0,h)rep(k,j+1,h){
		if(coin[i][j]&&coin[i][k]){
			int dis=k-j;
			if(i-dis>=0)ans+=sum[i-dis][k]-(j==0?0:sum[i-dis][j-1]);
			if(i+dis<h)ans+=sum[i+dis][k]-(j==0?0:sum[i+dis][j-1]);
		}
	}
	rep(i,0,h)rep(j,0,h){
		sum[i][j]=0;
	}
	h-=w;
	rep(i,0,h)rep(j,0,w){
		if(b[i][j]=='#'){
			sum[i+j][i-j+w-1]=1;
		}
	}
	h+=w;
	rep(i,0,h)rep(j,0,h){
		if(i!=0) sum[i][j]+=sum[i-1][j];
	}
	rep(i,0,h)rep(j,0,h)rep(k,j+1,h){
		if(coin[j][i]&&coin[k][i]){
			int dis=k-j;
			if(i-dis>=0)ans+=sum[k][i-dis]-(j==0?0:sum[j-1][i-dis])-coin[j][i-dis]-coin[k][i-dis];
			if(i+dis<h) ans+=sum[k][i+dis]-(j==0?0:sum[j-1][i+dis])-coin[j][i+dis]-coin[k][i+dis];
		}
	}
	cout<<ans<<endl;
	return 0;
}
