#include <stdio.h>

int t1,t2;

int h,w;
char ch;

bool coin[605][605];
int psa1[605][605];
int psa2[605][605];
int ans=0;

int main()
{
    #ifdef NOT_DMOJ
    freopen("data.txt","r",stdin);
    #endif // NOT_DMOJ
    scanf("%d%d",&h,&w);
    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            scanf(" %c",&ch);
            if (ch=='.') continue;
            // rotate by 45
            // (i,j) |-> (i-j,i+j)
            coin[i-j+301][i+j+1]=1;
            psa1[i-j+301][i+j+1]=1;
            psa2[i-j+301][i+j+1]=1;
            //printf("coin %d %d\n",i-j+300,i+j);
        }
    }
    for (int i=0; i<602; i++) {
        for (int j=0; j<602; j++) {
            psa1[i][j+1]+=psa1[i][j];
            psa2[i+1][j]+=psa2[i][j];
        }
    }
    for (int i=1; i<602; i++) {
        for (int j=(i%2); j<602; j+=2) {
            for (int k=j+2; k<602; k+=2) {
                if (coin[i][j] && coin[i][k]) {
                    // (i,j) (i,k)
                    // want coin at (i +- (k-j),x)
                    // where j <= x <= k
                    // avoid double counting weirdly
                    t1=ans;
                    if (i+k-j<602) ans+=psa1[i+k-j][k-1]-psa1[i+k-j][j];
                    if (i-k+j>0) ans+=psa1[i-k+j][k-1]-psa1[i-k+j][j];
                    //if (t1!=ans) printf("%d %d %d %d %d\n",ans,i-301,j-1,i-301,k-1);
                }
                if (coin[j][i] && coin[k][i]) {
                    // (j,i) (k,i)
                    // want coin at (x,i +- (k-j))
                    // where j <= x <= k
                    t1=ans;
                    if (i+k-j<602) ans+=psa2[k][i+k-j]-psa2[j-1][i+k-j];
                    if (i-k+j>0) ans+=psa2[k][i-k+j]-psa2[j-1][i-k+j];
                    //if (t1!=ans) printf("%d %d %d %d %d\n",ans,j-301,i-1,k-301,i-1);
                }
            }
        }
    }
    printf("%d\n",ans);
}
