#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
int H,W;
vector<string> s;
int dx[4] = {1,1,-1,-1};
int dy[4] = {1,-1,-1,1};
bool is(int x,int y){
	return 0<=x&&x<H&&0<=y&&y<W;
}
int count3(){
	int ans = 0;
	rep(i,H) rep(j,W) if(s[i][j]=='#') rep(d,4){
		for(int k=1;;k++){
			int x1 = i+dx[d]*k, y1 = j+dy[d]*k;
			int x2 = i+dx[(d+1)%4]*k, y2 = j+dy[(d+1)%4]*k;
			if(!is(x1,y1) || !is(x2,y2)) break;
			if(s[x1][y1]=='#' && s[x2][y2]=='#') ans++;
		}
	}
	return ans;
}
const int N = 700;
bool S[N][N];
int ac[N][N+1];
void rot(){
	bool s[N][N] = {};
	rep(i,N) rep(j,N) s[i][j] = S[j][N-1-i];
	rep(i,N) rep(j,N) S[i][j] = s[i][j];
	rep(i,N){
		ac[i][0] = 0;
		rep(j,N) ac[i][j+1] = ac[i][j] + S[i][j];
	}
}
ll solve(){
	int res = 0;
	rep(i,N){
		rep(r,N) if(S[i][r]){
			rep(l,r) if(S[i][l]){
				int d = r-l;
				int j = i+d;
				if(j>=N) continue;
//				for(int x=l;x<=r;x++) if(S[j][x]) res++;
				res += ac[j][r+1] - ac[j][l];
			}
		}
	}
	return res;
}
int main(){
	cin>>H>>W;
	s.resize(H);
	rep(i,H) cin>>s[i];
	ll ans = -count3();
	rep(i,H) rep(j,W) S[i+j][i-j+W] = s[i][j]=='#';
	rep(t,4){
		rot();
		ans += solve();
	}
	cout<<ans<<endl;
}