#include <bits/stdc++.h>
using namespace std;
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
bool ok(int x, int y, int n, int m) {
  return (0 <= x && x < n) && (0 <= y && y < m);
}
void makePrefixSum(vector<int>& arr) {
  for (int i = 1; i < ((int)((arr).size())); i++) {
    arr[i] += arr[i - 1];
  }
}
int prefSum(vector<int>& p, int a, int b, int dist) {
  if (a > b) {
    int t = a;
    a = b;
    b = t;
  }
  if (b >= ((int)((p).size()))) {
    b = ((int)((p).size())) - 1;
  }
  if (a < 0) {
    a = 0;
  }
  b -= dist;
  if (a > b) return 0;
  int res = p[b];
  if (a > 0) res -= p[a - 1];
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(15);
  cout.setf(ios::fixed);
  int n, m;
  cin >> n >> m;
  vector<string> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  const int diagCount = n + m - 1;
  long long ans = 0;
  for (int dist = 2; dist <= n + m - 2; dist += 2) {
    vector<vector<int>> d1(diagCount, vector<int>(diagCount));
    vector<vector<int>> d2(diagCount, vector<int>(diagCount));
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (a[i][j] == '#') {
          int z1 = i + j;
          int z2 = i + (m - j - 1);
          d1[z1][z2]++;
          d2[z2][z1]++;
        }
      }
    }
    for (int z1 = 0; z1 < diagCount; z1++) {
      for (int z2 = 0; z2 < diagCount; z2++) {
        if (d1[z1][z2] > 1) {
          throw 0;
        }
        if (d2[z2][z1] > 1) {
          throw 0;
        }
      }
    }
    vector<vector<int>> p1(diagCount, vector<int>(diagCount));
    vector<vector<int>> p2(diagCount, vector<int>(diagCount));
    for (int z1 = 0; z1 < diagCount; z1++) {
      for (int z2 = 0; z2 < diagCount; z2++) {
        if (d1[z1][z2] == 1 && z2 + dist < diagCount &&
            d1[z1][z2 + dist] == 1) {
          p1[z1][z2] = 1;
        }
        if (d2[z2][z1] == 1 && z1 + dist < diagCount &&
            d2[z2][z1 + dist] == 1) {
          p2[z2][z1] = 1;
        }
      }
    }
    for (auto& arr : p1) makePrefixSum(arr);
    for (auto& arr : p2) makePrefixSum(arr);
    long long curDistAns = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (a[i][j] == '#') {
          int cellAns = 0;
          for (int k = 0; k < 4; k++) {
            int xs = i + dist * dx[k];
            int ys = j + dist * dy[k];
            int xf = i + dist * dx[(k + 1) & 3];
            int yf = j + dist * dy[(k + 1) & 3];
            int z1s = xs + ys;
            int z2s = xs + (m - ys - 1);
            int z1f = xf + yf;
            int z2f = xf + (m - yf - 1);
            if (z1s == z1f) {
              if (0 <= z1s && z1s < diagCount) {
                int add = prefSum(p1[z1s], z2s, z2f, dist);
                cellAns += add;
              }
            } else if (z2s == z2f) {
              if (0 <= z2s && z2s < diagCount) {
                int add = prefSum(p2[z2s], z1s, z1f, dist);
                cellAns += add;
              }
            } else {
              throw 0;
            }
            int xm = (xs + xf) / 2;
            int ym = (ys + yf) / 2;
            if (ok(xs, ys, n, m) && ok(xm, ym, n, m)) {
              if (a[xs][ys] == '#' && a[xm][ym] == '#') {
                cellAns--;
              }
            }
          }
          curDistAns += cellAns;
        }
      }
    }
    ans += curDistAns;
  }
  cout << ans << endl;
}
