#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
int H, W;
vector<vector<int> > ruir;
vector<vector<int> > ruil;


int inner(int h, int w) {
    return h >= 0 && h <= H + 1 && w >= 0 && w <= W + 1;
}

int cntr(int sh, int sw, int th, int tw) {
    int tmp = max({-sh, -sw, 0});
//    tmp = max(0, tmp);
    sh += tmp;
    sw += tmp;
    tmp = max({th - (H + 1), tw - (W + 1), 0});
    th -= tmp;
    tw -= tmp;
    if (inner(sh, sw) && inner(th, tw)) {
        return ruir[th][tw] - ruir[sh][sw];
    }

    return 0;
}

int cntl(int sh, int sw, int th, int tw) {
    int tmp = max({-sh, sw - (W + 1), 0});
    sh += tmp;
    sw -= tmp;
    tmp = max({th - (H + 1), -tw, 0});
    th -= tmp;
    tw += tmp;

    if (inner(sh, sw) && inner(th, tw)) {
        return ruil[th][tw] - ruil[sh][sw];
    }

    return 0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> H >> W;
    ruir.resize(H + 2, vector<int>(W + 2));
    ruil.resize(H + 2, vector<int>(W + 2));
    vector<vector<char>> s(H + 1, vector<char>(W + 1));

    for (int i = 1; i <= H; ++i) {
        for (int j = 1; j <= W; ++j) {
            cin >> s[i][j];
            if (s[i][j] == '#') {
                ruir[i][j] = ruil[i][j] = 1;
            }
        }
    }

    for (int i = 1; i <= H; ++i) {
        for (int j = 1; j <= W; ++j) {
            ruir[i + 1][j + 1] += ruir[i][j];
            ruil[i + 1][j - 1] += ruil[i][j];
        }
    }

    ll ans = 0;

    for (int i = 1; i <= H; ++i) {
        for (int j = 1; j <= W; ++j) {
            if (s[i][j] == '#') {
                //right
                for (int t = 1; i + t <= H && j + t <= W; ++t) {
                    if (s[i + t][j + t] == '#') {
//                        int tmp = cntr(i - t, j + t, i - 1, j + 2 * t - 1);
//                        cout << tmp << endl;
//                        tmp = cntr(i + t, j - t, i + 2 * t - 1, j - 1);
//                        cout << tmp << endl;


                        ans += cntr(i - t, j + t, i - 1, j + 2 * t - 1);
                        ans += cntr(i + t, j - t, i + 2 * t - 1, j - 1);
                    }
                }
                //left
                for (int t = 1; i + t <= H && j - t > 0; ++t) {
                    if (s[i + t][j - t] == '#') {
//                        int tmp = cntl(i - t, j - t, i - 1, j - 2 * t + 1);
//                        cout << tmp << endl;
//                        tmp = cntl(i + t, j + t, i + 2 * t - 1, j + 1);
//                        cout << tmp << endl;

                        ans += cntl(i - t, j - t, i - 1, j - 2 * t + 1);
                        ans += cntl(i + t, j + t, i + 2 * t - 1, j + 1);
                    }
                }
            }
        }
    }

    //あれをカウント
    for (int i = 1; i <= H; ++i) {
        for (int j = 1; j <= W; ++j) {
            if (s[i][j] == '#') {
                for (int t = 1; i + 2 * t <= H; ++t) {
                    int i1 = i + 2 * t;
                    int j1 = j;
                    int i2 = i + t;
                    int j2 = j + t;
                    if (i1 <= H && j2 <= W && s[i1][j1] == '#' && s[i2][j2] == '#') {
                        ans++;
                    }

                    j2 = j - t;
                    if (i1 <= H && j2 >= 1 && s[i1][j1] == '#' && s[i2][j2] == '#') {
                        ans++;
                    }
                }


                for (int t = 1; j + 2 * t <= W; ++t) {
                    int i1 = i;
                    int j1 = j + 2 * t;
                    int i2 = i + t;
                    int j2 = j + t;

                    if (j1 <= W && i2 <= H && s[i1][j1] == '#' && s[i2][j2] == '#') {
                        ans++;
                    }

                    i2 = i - t;
                    if (j1 <= W && i2 >= 1 && s[i1][j1] == '#' && s[i2][j2] == '#') {
                        ans++;
                    }
                }
            }
        }
    }

    cout << ans << endl;


    return 0;
}




Measured memory_bytes: 1152