#include <bits/stdc++.h>
using namespace std;
long long sum[2100][2100];
int check(int i, int j, const vector<string> &fi) {
  int n = (int)fi.size();
  int m = (int)fi[0].size();
  if (i < 0 || i >= n || j < 0 || j >= m) return 0;
  if (fi[i][j] == '#')
    return 1;
  else
    return 0;
}
long long solve(vector<string> fi) {
  memset(sum, 0, sizeof(sum));
  int n = (int)fi.size();
  int m = (int)fi[0].size();
  for (int ij = 0; ij < n + m - 1; ++ij) {
    sum[ij][0] = 0;
    for (int i = 0; i < (n + m) * 3; ++i) {
      int j = ij - i;
      int add = 0;
      if (i >= 0 && i < n && j >= 0 && j < m && fi[i][j] == '#') add = 1;
      sum[ij][i + 1] = sum[ij][i] + add;
    }
  }
  long long res = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (fi[i][j] != '#') continue;
      for (int k = 1; k < n + m; ++k) {
        int i2 = i + k;
        int j2 = j - k;
        if (i2 < 0 || i2 >= n || j2 < 0 || j2 >= m) continue;
        if (fi[i2][j2] != '#') continue;
        {
          int ij = i + j - k * 2;
          if (ij >= 0) {
            if (check(i - k, j - k, fi)) ++res;
            if (check(i, j - k * 2, fi)) ++res;
            int a = max(i - k + 1, 0);
            int b = max(i, 0);
            if (a <= b) res += (sum[ij][b] - sum[ij][a]) * 2;
          }
        }
        {
          int ij = i + j + k * 2;
          if (ij <= n + m - 2) {
            if (check(i + k, j + k, fi)) ++res;
            if (check(i + k * 2, j, fi)) ++res;
            int a = i + k + 1;
            int b = i + k * 2;
            res += (sum[ij][b] - sum[ij][a]) * 2;
          }
        }
      }
    }
  }
  return res;
}
int main() {
  int H, W;
  cin >> H >> W;
  vector<string> input(H);
  for (int i = 0; i < H; ++i) cin >> input[i];
  long long res = 0;
  res += solve(input);
  for (int i = 0; i < H; ++i) reverse(input[i].begin(), input[i].end());
  res += solve(input);
  cout << res / 2 << endl;
}
