#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;
template <typename T>
class BIT {
 public:
  vector<T> data;
  int n;
  BIT() {}
  BIT(int n_) {
    n = n_;
    data.assign(n, T(0));
  }
  void add(int a, T w) {
    for (int x = a; x < n; x |= x + 1) data[x] += w;
  }
  T sum(int a) {
    T ret = 0;
    for (int x = a - 1; x >= 0; x = (x & (x + 1)) - 1) {
      ret += data[x];
    }
    return ret;
  }
};
string field[302];
int main() {
  int H, W;
  cin >> H >> W;
  vector<BIT<int>> bits(H + W, BIT<int>(H + W));
  vector<string> new_field(H + W, string(H + W, '.'));
  int cnt = 0;
  for (int i = 0; i < H; i++) {
    cin >> field[i];
    for (int j = 0; j < W; j++) {
      if (field[i][j] == '#') {
        int ni = i + j, nj = W - 1 + i - j;
        new_field[ni][nj] = '#';
        bits[ni].add(nj, 1);
      }
    }
  }
  for (auto& s : new_field) {
    cout << s << endl;
  }
  ll ans = 0;
  for (int i = 0; i < H + W; i++) {
    for (int j = 0; j < H + W; j++) {
      if (new_field[i][j] == '.') continue;
      for (int k = 1; j + k < H + W; k++) {
        if (new_field[i][j + k] == '.') continue;
        if (i + k < H + W) {
          ans += bits[i + k].sum(j + k + 1) - bits[i + k].sum(j);
        }
        if (0 <= i - k) {
          ans += bits[i - k].sum(j + k + 1) - bits[i - k].sum(j);
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
