#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define mmin(a, b) a = min(a, (b))
#define mmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define modsum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define modsubtract(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define modmultiply(a, b) (((a) * (b)) % M)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define cint const int &
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template<class T>
ostream & operator << (ostream &out, vector<T> &a) {
    out << "{";
    for (auto x : a) out << x << " ";
    return out << "}\n";
}

template<class T>
ostream & operator << (ostream &out, pair<T, T> &a) {
    out << "{";
    cout << a.first << ", " << a.second;
    return out << "}";
}

void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
#endif

    cout << setprecision(12) << fixed;

    smain();
}

const int N = 618;

vvi transpone(vvi a) {
    int n = a.size();
    int m = a[0].size();
    vvi ret(m, vi(n, 0));
    fori (i, n) fori (j, m) ret[j][i] = a[i][j];
    return ret;
}

ll get(vi &cnt, int l, int r) {
    if (!l--) return cnt[r];
    return cnt[r] - cnt[l];
}

ll solve(vvi a) {
    int n = a.size();
    vvi cnt(n, vi(n));
    ll ret = 0;
    fori (i, n) fori (j, n) {
        cnt[i][j] = a[i][j];
        if (j) cnt[i][j] += cnt[i][j - 1];
    }
    fori (i, n) fori (j, n) if (a[i][j]) fori (dif, n) if (dif) {
        if (j - dif >= 0 && a[i][j - dif]) {
            if (i - dif >= 0) ret += get(cnt[i - dif], j - dif, j);
            if (i + dif < n) ret += get(cnt[i + dif], j - dif, j);
        }
    }
    return ret;
}

ll solve2(vvi a) {
    int n = a.size();
    ll ret = 0;
    fori (i, n) fori (j, n) if (a[i][j]) fori (dif, n) if (dif) {
                        if (j - dif >= 0 && a[i][j - dif]) {
                            if (i - dif >= 0) ret += a[i - dif][j] + a[i - dif][j - dif];
                            if (i + dif < n) ret += a[i + dif][j] + a[i + dif][j - dif];
                        }
                    }
    return ret;
}

void smain() {

    int n, m;
    cin >> n >> m;

    vvi a(n, vi(m, 0));
    fori (i, n) {
        string s;
        cin >> s;
        fori (j, m) a[i][j] = s[j] == '#';
    }

    vector<vector<pii>> kek(n, vector<pii>(m, {0,0}));
    int mn = 0, mx = 0;
    fori (i, n) fori (j, m) {
        kek[i][j] = {i + j, i - j};
        mmin(mn, kek[i][j].second);
        mmax(mx, kek[i][j].first);
        mmin(mn, kek[i][j].first);
        mmax(mx, kek[i][j].second);
    }
    mn = -mn;
    mx += mn + 3;
    fori (i, n) fori (j, m) {
        kek[i][j].first += mn;
        kek[i][j].second += mn;
    }
    vvi b(mx, vi(mx, 0));
    fori (i, n) fori (j, m) b[kek[i][j].first][kek[i][j].second] = a[i][j];
//    watch(b);
    ll ans = solve(b);
    ans += solve(transpone(b));
    ll two = solve2(b);
//    watch(two);
    ans = ans - two;
    cout << ans;
}

Measured memory_bytes: 16140