#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 903;
int n,m,res;char s[N][N];
void rotate(){
	static char t[N][N];
	rep(i,1,n)rep(j,1,n)t[n-j+1][i]=s[i][j];
	memcpy(s,t,sizeof(t));
}
int cnt[N][N],val[N][N];
void solve(){
//	memset(cnt,0,sizeof(cnt));
//	memset(val,0,sizeof(val));
	per(i,n,0)per(j,n,0){
		cnt[i][j]=cnt[i+1][j+1]+(s[i][j]=='#');
	}
	rep(i,1,n)per(j,n,0)val[i][j]=(val[i-1][j+1])+(s[i][j]=='#');
	for(int x=2;x<=2*n;x+=2){
		int mid=x>>1;
		rep(i,1,n-mid)rep(j,1,n-mid)if(s[i][j]=='#'&&s[i+mid][j+mid]=='#'){
			int a=i-mid,b=j+mid;if(a<0)b-=a,a-=a;res+=cnt[a][b]-cnt[i][j+x];
		//	if(i==1&&j==2)printf("QAQ");
			a=i+mid,b=j-mid;if(b<0)a-=b,b-=b;res+=cnt[a][b]-cnt[i+x+1][j+1];
		}
		rep(i,mid+1,n)rep(j,1,n-mid)if(s[i][j]=='#'&&s[i-mid][j+mid]=='#'){
			int a=i+mid-1,b=j+mid+1;if(a>n)b=a+b-n,a=n;
			res+=val[a][b]-val[i][j+x];
		}
	}
}
int main() {
	read(n);read(m);rep(i,1,n)scanf("%s",s[i]+1);//WA!!
	n=m=max(n,m);
	solve();
	rotate();solve();
	rotate();solve();
	rotate();solve();
	cout<<res/3;return 0;
}
