#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
vector<string> rotateClockwise(vector<string> g) {
    int n = g.size();
    int m = g[0].size();
    vector<string> res(m, string(n, '#'));
    rep(i, 0, n) rep(j, 0, m) res[j][n - i - 1] = g[i][j];
    return res;
}
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/



int H, W;
vector<string> S;
//---------------------------------------------------------------------------------------------------
int sm[606][303];
ll get() {
    rep(xy, 0, 606) rep(x, 0, 303) sm[xy][x] = 0;
    rep(y, 0, H) rep(x, 0, W) {
        if (S[y][x] == '#') sm[y + x][x] = 1;
        else sm[y + x][x] = 0;
    }
    rep(xy, 0, 606) rep(x, 1, 303) sm[xy][x] += sm[xy][x - 1];

    ll res = 0;
    rep(x, 0, W) rep(y, 0, H) {
        int xy = x + y;
        rep(d, 1, 303) {
            int xx = x + d;
            int yy = y - d;
            if (W <= xx or yy < 0) break;

            if (S[y][x] == '#' and S[yy][xx] == '#') {
                if (0 <= xy - d * 2) {
                    int a = max(0, x - d);
                    int b = max(0, xx - d);

                    int s = sm[xy - d * 2][b];
                    if (0 < a) s -= sm[xy - d * 2][a - 1];
                    res += s;
                }

                if (xy + d * 2 <= 605) {
                    int a = min(302, x + d);
                    int b = min(302, xx + d);

                    int s = sm[xy + d * 2][b];
                    if (0 < a) s -= sm[xy + d * 2][a - 1];
                    res += s;
                }
            }
        }
    }

    return res;
}
//---------------------------------------------------------------------------------------------------
ll sub() {
    ll res = 0;
    rep(y, 0, H) rep(sx, 0, W) rep(tx, sx + 1, W) {
        int d = tx - sx;
        if (d % 2 == 1) continue;
        d /= 2;
        if (S[y][sx] == '#' and S[y][tx] == '#') {
            if (0 <= y - d) {
                if (S[y - d][sx + d] == '#') res++;
            }
            if (y + d < H) {
                if (S[y + d][sx + d] == '#') res++;
            }
        }
    }
    return res;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> H >> W;
    rep(y, 0, H) {
        string s; cin >> s;
        S.push_back(s);
    }

    ll ans = get();
    ans -= sub();
    S = rotateClockwise(S);
    swap(H, W);
    ans += get();
    ans -= sub();
    cout << ans << endl;
}

Measured memory_bytes: 1280