#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
pair<int, int> f(int H, int W, const vector<string>& S) {
    vector<vector<int>> sum(H + W - 1, vector<int>(W + 1));
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            sum[i + j][j + 1] += S[i][j] == '#';
        }
    }
    for (int i = 0; i < H + W - 1; i++) {
        for (int j = 0; j < W; j++) {
            sum[i][j + 1] += sum[i][j];
        }
    }
    int a = 0, b = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (S[i][j] != '#') continue;
            for (int n = 1; i - n >= 0 && j + n < W; n++) {
                if (S[i - n][j + n] != '#') continue;
                if (i - 2*n >= 0 && S[i - 2*n][j] == '#') a++;
                if (j - n >= 0 && S[i - n][j - n] == '#') a++;
                if (i + j - 2*n >= 0) {
                    int x = max(j - n + 1, 0);
                    int y = j - 1;
                    if (y >= 0) {
                        b += sum[i + j - 2*n][y + 1] - sum[i + j - 2*n][x];
                    }
                }
            }
        }
    }
    return {a, b};
}
void rotate(int &H, int &W, vector<string>& S) {
    vector<string> ans(W, string(H, '@'));
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            ans[j][H - 1 - i] = S[i][j];
        }
    }
    swap(S, ans), swap(H, W);
}
int main() {
    int H, W; cin >> H >> W;
    vector<string> S(H); for (auto &s : S) cin >> s;
    int a = 0, b = 0;
    for (int i = 0; i < 4; i++) {
        auto p = f(H, W, S);
        a += p.first, b += p.second;
        rotate(H, W, S);
    }
    cout << a / 2 + b << endl;
    return 0;
}
