#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
ll c[601][601], c1[601][601], c2[601][601];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < w; j++) {
            if (s[j] == '#') {
                c[i + j][i - j + 300]++;
            }
        }
    }
    for (int i = 0; i <= 600; i++) {
        c1[i][0] = c[i][0];
        for (int j = 1; j <= 600; j++) {
            c1[i][j] = c1[i][j - 1] + c[i][j];
        }
    }
    for (int i = 0; i <= 600; i++) {
        c2[0][i] = c[0][i];
        for (int j = 1; j <= 600; j++) {
            c2[j][i] = c2[j - 1][i] + c[j][i];
        }
    }
    ll res1 = 0, res2 = 0;
    for (int i = 0; i <= 600; i++) {
        for (int j = 0; j <= 600; j++) {
            for (int k = j + 1; k <= 600; k++) {
                if (c[i][j] && c[i][k]) {
                    if (i + k - j <= 600) {
                        res1 += c[i + k - j][k] + c[i + k - j][j];
                        res2 += c1[i + k - j][k - 1] - c1[i + k - j][j];
                    }
                    if (i - (k - j) >= 0) {
                        res1 += c[i - (k - j)][k] + c[i - (k - j)][j];
                        res2 += c1[i - (k - j)][k - 1] - c1[i - (k - j)][j];
                    }
                }
                if (c[k][i] && c[j][i]) {
                    if (i + k - j <= 600) {
                        res1 += c[k][i + k - j] + c[j][i + k - j];
                        res2 += c2[k - 1][i + k - j] - c2[j][i + k - j];
                    }
                    if (i - (k - j) >= 0) {
                        res1 += c[k][i - (k - j)] + c[j][i - (k - j)];
                        res2 += c2[k - 1][i - (k - j)] - c2[j][i - (k - j)];
                    }
                }
            }
        }
    }
    cout << res1 / 2LL + res2 << endl;
}