#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H,W; cin >> H >> W;
    vector<string> S(H);
    for (int i=0;i<H;++i) cin >> S[i];
    ll ans0=0,ans1=0;
    for (int _=0;_<2;++_){
        vector<vector<ll>> sum(H+W-1,vector<ll>(H+1,0));
        for (int i=0;i<H;++i)
            for (int j=0;j<W;++j)
                sum[i+j][i+1]+=(S[i][j]=='#');
        for (int i=0;i<H+W-1;++i)
            for (int j=0;j<H;++j)
                sum[i][j+1]+=sum[i][j];
        for (int i=0;i<H;++i){
            for (int j=0;j<W;++j){
                if (S[i][j]!='#') continue;
                for (int k=1;i-k>=0&&j+k<W;++k){
                    if (S[i-k][j+k]!='#') continue;
                    if (i+j+2*k<=H+W-2) ans0+=sum[i+j+2*k][min(H,i+k)]-sum[i+j+2*k][i+1];
                    if (i+j-2*k>=0) ans0+=sum[i+j-2*k][i-k]-sum[i+j-2*k][max(0,i-2*k+1)];
                    ans1+=(i+k<H&&S[i+k][j+k]=='#');
                    ans1+=(j+2*k<W&&S[i][j+2*k]=='#');
                    ans1+=(i-k>=0&&j-k>=0&&S[i-k][j-k]=='#');
                    ans1+=(i-2*k>=0&&S[i-2*k][j]=='#');
                }
            }
        }
        for (int i=0;i<H;++i)
            reverse(S[i].begin(),S[i].end());
    }
    cout << ans0+ans1/2 << '\n';
}