#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]);
    auto Dist = [](auto a, auto b) {
        return abs(a.first - b.first) + abs(a.second - b.second);
    };
    /* {
        vector<pair<int, int>> v;
        for (int i = 0; i < h; ++i) {
            for (int j = 0; j < w; ++j) {
                if (s[i][j] == '#') v.emplace_back(i, j);
            }
        }
        int ans = 0;
        for (int i = 0; i < v.size(); ++i) {
            for (int j = i + 1; j < v.size(); ++j) {
                for (int k = j + 1; k < v.size(); ++k) {
                    if (Dist(v[i], v[j]) == Dist(v[j], v[k]) && Dist(v[j], v[k]) == Dist(v[i], v[k])) {
                        ans++;
                        if (v[i].first == v[j].first || v[i].first == v[k].first || v[j].first == v[k].first) continue;
                        if (v[i].second == v[j].second || v[i].second == v[k].second || v[j].second == v[k].second) continue;
                        if (!(abs(v[i].first - v[j].first) == abs(v[i].second - v[k].second) ||
                               abs(v[i].first - v[k].first) == abs(v[i].second - v[j].second) ||
                               abs(v[j].first - v[i].first) == abs(v[j].second - v[k].second) ||
                               abs(v[j].first - v[k].first) == abs(v[j].second - v[i].second) ||
                               abs(v[k].first - v[i].first) == abs(v[k].second - v[j].second) ||
                               abs(v[k].first - v[j].first) == abs(v[k].second - v[i].second))) {
                            assert(abs(v[i].first - v[j].first) == abs(v[i].second - v[j].second) ||
                                   abs(v[j].first - v[k].first) == abs(v[j].second - v[k].second) ||
                                   abs(v[i].first - v[k].first) == abs(v[i].second - v[k].second));
                            // printf("v[i] = (%d, %d), v[j] = (%d, %d), v[k] = (%d, %d)\n", v[i].first, v[i].second, v[j].first, v[j].second, v[k].first, v[k].second);
                        }
                    }
                }
            }
        }
        printf("ans = %d\n", ans);
    } */
    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 dx = -1; dx <= 1; dx += 2) {
            //     for (int dy = -1; dy <= 1; dy += 2) {
            //         for (int d = 3; ; d += 3) {
            //             if (i + d * dx < 0 || i + d * dx >= h) break;
            //             if (j + d * dy < 0 || j + d * dy >= w) break;
            //             int k = d * 4 / 3;
            //             ans += s[i + d * dx][j + (k - d) * dy] == '#' && s[i + (k - d) * dx][j + d * dy] == '#';
            //         }
            //     }
            // }
            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<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].push_back(i);
                v.emplace_back(i, j);
            }
        }
        // for (int i = 0; i < h; ++i) {
        //     for (int j = 0; j < w; ++j) printf("%c", s[i][j]);
        //     puts("");
        // }
        // puts("");
        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;
                    // for (auto p : v) {
                    //     if (Dist(p, make_pair(i + d, j)) == d + d && Dist(p, make_pair(i, j + d)) == d + d) {
                    //         if (p.first <= i + d || p.second <= j + d) continue;
                    //         // if (p.first == i + d || p.second == j + d) continue;
                    //         ++ans;
                    //     }
                    // }
                    if (sum < h + w) {
                        // for (int u : cd[sum]) printf("%d ", u); puts("");
                        int l = i + d, r = sum - j - d;
                        // printf("i = %d j = %d d = %d sum = %d l = %d r = %d\n", i, j, d, sum, l, r);
                        // for (int u : cd[sum]) {
                        //     if (u > l && u < r) printf("(%d, %d) ", u, sum - u);
                        // }
                        // puts("");
                        int add = lower_bound(cd[sum].begin(), cd[sum].end(), r) - upper_bound(cd[sum].begin(), cd[sum].end(), l);
                        // if (binary_search(cd[sum].begin(), cd[sum].end(), sum - (j + d))) --add;
                        // if (binary_search(cd[sum].begin(), cd[sum].end(), i + d)) --add;
                        // printf("add = %d\n", add);
                        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;
}


Measured memory_bytes: 2224