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

const int kN = 300 + 5;
char s[kN][kN], t[kN][kN];

int main() {
    int h, w; scanf("%d%d", &h, &w);
    for (int i = 0; i < h; ++i) scanf("%s", s[i]);
    long long ans = 0;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (s[i][j] == '.') continue;
            for (int d = 2; ; d += 2) {
                if (i + d >= h) break;
                if (s[i + d][j] == '.') continue;
                if (j + d / 2 < w) ans += s[i + d / 2][j + d / 2] == '#';
                if (j - d / 2 >= 0) ans += s[i + d / 2][j - d / 2] == '#';
            }
            for (int d = 2; ; d += 2) {
                if (j + d >= w) break;
                if (s[i][j + d] == '.') continue;
                if (i + d / 2 < h) ans += s[i + d / 2][j + d / 2] == '#';
                if (i - d / 2 >= 0) ans += s[i - d / 2][j + d / 2] == '#';
            }
        }
    }
    for (int rot = 0; rot < 4; ++rot) {
        vector<vector<int>> cd(h + w, vector<int>(h));
        vector<pair<int, int>> v;
        for (int i = 0; i < h; ++i) {
            for (int j = 0; j < w; ++j) {
                if (s[i][j] == '.') continue;
                cd[i + j][i]++;
            }
        }
        for (int i = 0; i < h + w; ++i) {
            for (int j = 1; j < h; ++j) cd[i][j] += cd[i][j - 1];
        }
        for (int i = 0; i < h; ++i) {
            for (int j = 0; j < w; ++j) {
                for (int d = 1; i + d < h && j + d < w; ++d) {
                    if (s[i + d][j] == '.' || s[i][j + d] == '.') continue;
                    int sum = i + j + 3 * d;
                    if (sum < h + w) {
                        int l = i + d, r = sum - j - d;
                        int add = cd[sum][min(h - 1, r - 1)] - cd[sum][l];
                        ans += add;
                    }
                }
            }
        }
        for (int i = 0; i < h; ++i) {
            for (int j = 0; j < w; ++j) t[w - 1 - j][i] = s[i][j];
        }
        swap(h, w);
        for (int i = 0; i < h; ++i) {
            for (int j = 0; j < w; ++j) s[i][j] = t[i][j];
        }
    }
    printf("%lld\n", ans);
    return 0;
}
