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

#define rep(i, N) for (int i = 0; i < (N); i++)

int f(vector<vector<bool>> a) {
    int H = a.size();
    int W = a[0].size();
    int ans = 0;
    rep(y, H) rep(x, W) {
        for (int d = 1; y + d < H && x - d >= 0 && x + d < W; d++) {
            if (a[y][x] && a[y + d][x - d] && a[y + d][x + d])
                ans++;
        }
    }
    vector<vector<int>> sum(H + 1, vector<int>(W + 1));
    rep(y, H) rep(x, W) sum[y + 1][x + 1] = sum[y][x] + a[y][x];
    rep(y1, H) rep(x1, W) {
        for (int d = 2; y1 + d < H && x1 + d < W; d++) {
            int y2 = y1 + d;
            int x2 = x1 + d;
            if (!a[y1][x1]) continue;
            if (!a[y2][x2]) continue;
            int y3 = y1 + d + 1;
            int x3 = x1 - d + 1;
            int y4 = y2 + d - 1;
            int x4 = x2 - d - 1;
            if (x3 < 0) {
                y3 -= x3;
                x3 = 0;
            }
            if (y4 > H - 1) {
                x4 -= y4 - (H - 1);
                y4 = H - 1;
            }
            if (0 <= y3 && y3 < H && 0 <= x4 && x4 < W)
                ans += sum[y4 + 1][x4 + 1] - sum[y3][x3];
        }
    }
    return ans;
}

vector<vector<bool>> rotate(vector<vector<bool>> a) {
    int H = a.size();
    int W = a[0].size();
    vector<vector<bool>> b(W, vector<bool>(H));
    rep(y, H) rep(x, W) b[x][H - 1 - y] = a[y][x];
    return b;
}

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<bool>> a(H, vector<bool>(W));
    rep(y, H) {
        string s; cin >> s;
        rep(x, W) a[y][x] = (s[x] == '#');
    }
    int ans = 0;
    rep(t, 4) {
        ans += f(a);
        a = rotate(a);
    }
    cout << ans << endl;
}
