/*input
5 4
#.##
.##.
#...
..##
...#
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) (int)(a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const int maxn=1005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int n,m;

string s[305];

int neg[maxn][maxn];
int pos[maxn][maxn];


bool isv(int x,int y){
	return x>=0&&x<n&&y>=0&&y<m;
}

int main()
{
	IOS;
	cin>>n>>m;
	REP(i,n) cin>>s[i];
	REP(i,n) REP(j,m){
		neg[i-j+m][i]=(s[i][j]=='#');
		pos[i+j][i]=(s[i][j]=='#');
	}
	REP(i,605){
		for(int j=1;j<maxn;j++){
			neg[i][j]+=neg[i][j-1];
		}
		for(int j=1;j<maxn;j++){
			pos[i][j]+=pos[i][j-1];
		}
	}
	ll ans=0;
	for(int sum=0;sum<=n-1+m-1;sum++){
		for(int i=0;i<n;i++) for(int j=i+1;j<n;j++){
			if(isv(i,sum-i)&&isv(j,sum-j)&&s[i][sum-i]=='#'&&s[j][sum-j]=='#'){
				//cout<<i<<' '<<sum-i<<' '<<j<<' '<<sum-j<<endl;
				REP(I,1){
					int l=i+i-j,r=i;
					int ss=sum+i+i-j-j;
					if(ss<0||sum>n-1+m-1) break;

					l=max(l,0);r=min(r,maxn);
					ans+=pos[ss][r];
					if(l!=0) ans-=pos[ss][l-1];
				}
				REP(I,1){
					int l=j,r=j+j-i;
					int ss=sum-i-i+j+j;
					if(ss<0||sum>n-1+m-1) break;

					l=max(l,0);r=min(r,maxn);
					ans+=pos[ss][r];
					if(l!=0) ans-=pos[ss][l-1];
				}
				//cout<<ans<<'\n';
			}
		}
	}
	//cout<<"A"<<ans<<endl;
	for(int sub=1;sub<=(n-1)+m;sub++){
		REP(i,n) for(int j=i+1;j<n;j++){
			if(isv(i,i+m-sub)&&isv(j,j+m-sub)&&s[i][i+m-sub]=='#'&&s[j][j+m-sub]=='#'){
				//cout<<i<<' '<<i+m-sub<<' '<<j<<' '<<j+m-sub<<'\n';
				REP(I,1){
					int l=i+i-j,r=i;
					int ss=i+i-j-j+sub;
					if(ss<1||ss>n-1+m) break;

					l=max(l,0);r=min(r,maxn);
					ans+=neg[ss][r];
					if(l!=0) ans-=neg[ss][l-1];
				}
				REP(I,1){
					int l=j,r=j+j-i;
					int ss=j+j-i-i+sub;
					if(ss<1||ss>n-1+m) break;

					l=max(l,0);r=min(r,maxn);
					ans+=neg[ss][r];
					if(l!=0) ans-=neg[ss][l-1];
				}
				//cout<<ans<<'\n';
			}
		}
	}
	//cout<<"B"<<ans<<'\n';

	REP(i,n) REP(j,m) for(int k=j+2;k<m;k+=2){
		if(s[i][j]=='#'&&s[i][k]=='#'){
			if(isv(i-(k-j)/2,(j+k)/2)&&s[i-(k-j)/2][(j+k)/2]=='#'){
				ans--;
				//cout<<'A'<<i<<' '<<j<<' '<<k<<'\n';
			}
			if(isv(i+(k-j)/2,(j+k)/2)&&s[i+(k-j)/2][(j+k)/2]=='#'){
				ans--;
				//cout<<'A'<<i<<' '<<j<<' '<<k<<'\n';
			}
		}
	}
	REP(j,m) REP(i,n) for(int k=i+2;k<n;k+=2){
		if(s[i][j]=='#'&&s[k][j]=='#'){
			if(isv((i+k)/2,j-(k-i)/2)&&s[(i+k)/2][j-(k-i)/2]=='#'){
				ans--;
				//cout<<'B'<<i<<' '<<j<<' '<<k<<'\n';
			}
			if(isv((i+k)/2,j+(k-i)/2)&&s[(i+k)/2][j+(k-i)/2]=='#'){
				ans--;
				//cout<<'B'<<i<<' '<<j<<' '<<k<<'\n';
			}
		}
	}


	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 6656