#include <bits/stdc++.h>
#define REP(i, a, n) for (ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

vector<vector<char>> rotate(ll H, ll W, const vector<vector<char>> &S) {
  const ll INF = 1LL << 60;
  ll miny = INF, minx = INF, maxy = -INF, maxx = -INF;
  vector<pair<ll, ll>> p;
  REP(i, 0, H) REP(j, 0, W) {
    if (S[i][j] == '#') {
      ll y = j + i, x = j - i;
      p.push_back(make_pair(y, x));
      miny = min(miny, y);
      minx = min(minx, x);
      maxy = max(maxy, y);
      maxx = max(maxx, x);
    }
  }

  ll h = p.size() > 0 ? maxy - miny + 1 : 1;
  ll w = p.size() > 0 ? maxx - minx + 1 : 1;
  vector<vector<char>> s(h, vector<char>(w, '.'));
  REP(i, 0, p.size()) {
    s[p[i].first - miny][p[i].second - minx] = '#';
  }
  return s;
}

int main(void) {
  ll H, W;
  cin >> H >> W;
  vector<vector<char>> S(H, vector<char>(W));
  REP(i, 0, H) REP(j, 0, W) cin >> S[i][j];

  S = rotate(H, W, S);
  H = S.size();
  W = S[0].size();

  vector<vector<ll>> row(H, vector<ll>(W + 1));
  REP(i, 0, H) REP(j, 0, W) row[i][j + 1] = row[i][j] + (S[i][j] == '#' ? 1 : 0);

  vector<vector<ll>> col(W, vector<ll>(H + 1));
  REP(i, 0, W) REP(j, 0, H) col[i][j + 1] = col[i][j] + (S[j][i] == '#' ? 1 : 0);

  ll ans = 0, ans2 = 0;
  REP(i, 0, H) REP(j, 0, W) if (S[i][j] == '#') {
    REP(x, j + 1, W) if (S[i][x] == '#') {
      ll t = x - j;
      if (0 <= i - t && i - t < H) {
        ans += row[i - t][x + 1] - row[i - t][j];
        if (S[i - t][x] == '#') ans2++;
        if (S[i - t][j] == '#') ans2++;
      }
      if (0 <= i + t && i + t < H) {
        ans += row[i + t][x + 1] - row[i + t][j];
        if (S[i + t][x] == '#') ans2++;
        if (S[i + t][j] == '#') ans2++;
      }
    }
    REP(y, i + 1, H) if (S[y][j] == '#') {
      ll t = y - i;
      if (0 <= j - t && j - t < W) {
        ans += col[j - t][y + 1] - col[j - t][i];
        if (S[y][j - t] == '#') ans2++;
        if (S[i][j - t] == '#') ans2++;
      }
      if (0 <= j + t && j + t < W) {
        ans += col[j + t][y + 1] - col[j + t][i];
        if (S[y][j + t] == '#') ans2++;
        if (S[i][j + t] == '#') ans2++;
      }
    }
  }
  cout << ans - ans2 / 2 << endl;
}