#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n, m;
char a[444][444];
int b[444][444], hor[444][444], ver[444][444];
string s;

LL solve() {
    LL res = 0;
    forn(i, 400) {
        hor[i][0] = 0;
        forn(j, 400) {
            hor[i][j + 1] = hor[i][j] + b[i][j];
        }
    }
    forn(j, 400) {
        ver[0][j] = 0;
        forn(i, 400) {
            ver[i + 1][j] = ver[i][j] + b[i][j];
        }
    }
    forn(i, 400) {
        forn(jj, 400) forn(j, jj) {
            if (!b[i][j] || !b[i][jj]) {
                continue;
            }
            int ii = i - (jj - j);
            if (ii >= 0 && ii < 400) {
                res += hor[ii][jj + 1] - hor[ii][j];
            }
            ii = i + (jj - j);
            if (ii >= 0 && ii < 400) {
                res += hor[ii][jj + 1] - hor[ii][j];
            }
        }
    }
    forn(j, 400) {
        forn(ii, 400) forn(i, ii) {
            if (!b[i][j] || !b[ii][j]) {
                continue;
            }
            int jj = j - (ii - i);
            if (jj >= 0 && jj < 400) {
                res += ver[ii][jj] - ver[i + 1][jj];
            }
            jj = j + (ii - i);
            if (jj >= 0 && jj < 400) {
                res += ver[ii][jj] - ver[i + 1][jj];
            }
        }
    }
    return res;
}

int main() {
//    freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin >> n >> m;
    forn(i, n) {
        cin >> s;
        forn(j, m) {
            a[i][j] = s[j];
        }
    }
    LL ans = 0;
    forn(t, 2) {
        memset(b, 0, sizeof b);
        forn(i, n) forn(j, m) {
            if ((i + j) % 2 == t && a[i][j] == '#') {
                b[(i + j + t) / 2][(i - j + t) / 2 + 180] = 1;
            }
        }
        ans += solve();
    }
    cout << ans << endl;
    return 0;
}
