#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int H, W;
char F[333][333];

const int LIMIT = 611;
bool B[621][621];
int M[621][621];

void MAIN() {
    scanf("%d%d", &H, &W);
    REP (i, H) scanf("%s", F[i]);
    REP (i, H) REP (j, W) if (F[i][j] == '#') {
	int y = i - j + 300;
	int x = i + j;
	B[y][x] = true;
    }
    LL ans = 0;

    REP (i, LIMIT) REP (j, LIMIT) {
	M[i][j+1] = M[i][j] + (int)B[i][j];
    }

    REP (i, LIMIT) REP (j, LIMIT) if (B[i][j]) {
	for (int k=j+1; k<LIMIT; k++) if (B[i][k]) {
	    int d = k-j;
	    if (0 <= i-d) {
		ans += M[i-d][k+1] - M[i-d][j];
	    }
	    if (i+d < LIMIT) {
		ans += M[i+d][k+1] - M[i+d][j];
	    }
	}
    }

    memset(M, 0, sizeof M);
    REP (i, LIMIT) REP (j, i) swap(B[i][j], B[j][i]);
    REP (i, LIMIT) REP (j, LIMIT) {
	M[i][j+1] = M[i][j] + (int)B[i][j];
    }

    REP (i, LIMIT) REP (j, LIMIT) if (B[i][j]) {
	for (int k=j+1; k<LIMIT; k++) if (B[i][k]) {
	    int d = k-j;
	    if (0 <= i-d) {
		ans += M[i-d][k] - M[i-d][j+1];
	    }
	    if (i+d < LIMIT) {
		ans += M[i+d][k] - M[i+d][j+1];
	    }
	}
    }

    printf("%lld\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}

