#include <iostream>
#include <fstream>
using namespace std;
const int nmax=305;
string s;
int dL[]={-1,0,1,0};
int dC[]={0,-1,0,1};
int a[2*nmax][2*nmax];
int ss[2*nmax][2*nmax];
int n,m,t,i,j,dist,A1,A2,B1,B2,lim;
long long ans=0;
void conv()
{
    for(j=1;j<=m;j++)
        if(s[j]=='#')
    {
        a[i-j+t][i+j]=1;
    }
}
int abss(int x)
{
    if(x<0) return -x;
    return x;
}
int man(int A1,int B1,int A2,int B2)
{
    return max(abss(A1-A2),abss(B1-B2));
}
bool ok(int A1,int B1)
{
    return (A1>=1&&A1<=2*t&&B1>=1&&B1<=2*t&&a[A1][B1]);
}
int chk(int A,int B,int D,int d1,int d2)
{
    A1=A+dL[d1]*D;B1=B+dC[d1]*D;
    A2=A+dL[d2]*D;B2=B+dC[d2]*D;
    if((!ok(A2,B2))) return 0;
    if(man(A1,B1,A2,B2)!=D)
        return 0;
    return 1;
}
int sum(int A1,int B1,int A2,int B2)
{
    if(A1<=0||A2>2*t) return 0;
    if(B1<=0||B2>2*t) return 0;
    if(A1>A2||B1>B2) return 0;
    return ss[A2][B2]-ss[A2][B1-1]-ss[A1-1][B2]+ss[A1-1][B1-1];
}
void cat(int A,int B,int D)
{
    A1=A-D;B1=B;
    if(ok(A1,B1))
    {
        ans+=1LL*sum(A1+1,B-D,A-1,B-D);
        ans+=1LL*sum(A1+1,B+D,A-1,B+D);
    }
    A1=A;B1=B-D;
    if(ok(A1,B1))
    {
        ans+=1LL*sum(A-D,B1+1,A-D,B-1);
        ans+=1LL*sum(A+D,B1+1,A+D,B-1);
    }
}
int main()
{
    //freopen("data.in","r",stdin);
    ios_base::sync_with_stdio(false);
    cin>>n>>m;
    t=max(n,m);
    for(i=1;i<=n;i++)
    {
        cin>>s;
        s=" "+s;
        conv();
    }
    for(i=1;i<=2*t;i++)
        for(j=1;j<=2*t;j++)
          ss[i][j]=ss[i-1][j]+ss[i][j-1]-ss[i-1][j-1]+a[i][j];
    for(i=1;i<=2*t;i++)
        for(j=1;j<=2*t;j++)
            if(a[i][j])
    {
        lim=max(max(i,j),max(2*t-i,2*t-j));
        for(dist=1; dist<=lim; dist++)
        {
            for(int i1=0; i1<4; i1++)
               if(ok(i+dL[i1]*dist,j+dC[i1]*dist))
                for(int i2=i1+1; i2<4; i2++)
                    ans+=1LL*chk(i,j,dist,i1,i2);
            cat(i,j,dist);
        }
    }
    cout<<ans;
    return 0;
}
