#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const long long MOD = 998244353;
int x[600][600];
int y[600][600];
int main() {
  int H, W;
  cin >> H >> W;
  vector<string> s(H);
  for (int i = 0; i < H; i++) cin >> s[i];
  set<pair<int, int> > coin;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (s[i][j] == '#') {
        int nx = j - i + 300, ny = j + i;
        x[ny][nx]++;
        y[ny][nx]++;
        coin.insert(pair<int, int>(nx, ny));
      }
    }
  }
  for (int i = 0; i < 600; i++) {
    for (int j = 1; j < 600; j++) {
      x[i][j] += x[i][j - 1];
    }
  }
  for (int i = 0; i < 600; i++) {
    for (int j = 1; j < 600; j++) {
      y[j][i] += y[j - 1][i];
    }
  }
  long long ans = 0;
  long long t = 0;
  for (int d = 1; d < 600; d++) {
    for (pair<int, int> p : coin) {
      if (coin.find(pair<int, int>(p.first + d, p.second)) != coin.end()) {
        if (p.second + d < 600) {
          ans += x[p.second + d][p.first + d];
          if (p.first > 0) ans -= x[p.second + d][p.first - 1];
        }
        if (p.second - d >= 0) {
          ans += x[p.second - d][p.first + d];
          if (p.first > 0) ans -= x[p.second - d][p.first - 1];
        }
      }
      if (coin.find(pair<int, int>(p.first, p.second + d)) != coin.end()) {
        if (p.first + d < 600) {
          ans += y[p.second + d][p.first + d];
          if (p.second > 0) ans -= y[p.second - 1][p.first + d];
        }
        if (p.first - d >= 0) {
          ans += y[p.second + d][p.first - d];
          if (p.second > 0) ans -= y[p.second - 1][p.first - d];
        }
      }
      for (int i = -1; i <= 1; i += 2) {
        if (coin.find(pair<int, int>(p.first + d * i, p.second)) == coin.end())
          continue;
        for (int j = -1; j <= 1; j += 2) {
          if (coin.find(pair<int, int>(p.first, p.second + d * j)) ==
              coin.end())
            continue;
          t++;
        }
      }
    }
  }
  ans -= t;
  cout << ans << endl;
}
