#include <bits/stdc++.h>
using namespace std;
vector<string> Rotate(vector<string> mat) {
  int n = mat.size(), m = mat[0].size();
  vector<string> ret(m, string(n, '.'));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      ret[m - j - 1][i] = mat[i][j];
    }
  }
  return ret;
}
int ans2 = 0, ans = 0;
pair<int, int> GET(int i1, int j1, int i2, int j2) {
  int perim = (j2 - j1) + (i2 - i1);
  assert(perim % 2 == 0);
  int dj = j2 - j1;
  int di = 3 * perim / 2 - dj;
  int i3 = i1 + di;
  int j3 = j1 + perim - di;
  return make_pair(i3, j3);
}
void Solve(vector<string> mat) {
  int n = mat.size(), m = mat[0].size();
  vector<bitset<300>> odd_rows(300), even_rows(300), diag(600);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (mat[i][j] == '.') continue;
      if (j % 2 == 0)
        even_rows[i][j / 2] = true;
      else
        odd_rows[i][j / 2] = true;
      diag[i - j + m][j] = true;
    }
  }
  for (int i1 = 0; i1 < n; ++i1) {
    for (int j1 = 0; j1 < m; ++j1) {
      if (mat[i1][j1] == '.') continue;
      for (int i2 = i1 + 1; i2 < n; ++i2) {
        int j2 = (j1 + (i2 - i1));
        auto row_bs = (j2 % 2 ? odd_rows[i2] : even_rows[i2]) >> (j2 / 2);
        int i3, j3;
        tie(i3, j3) = GET(i1, j1, i2, j2);
        assert(j3 >= j1);
        auto diag_bs = diag[i3 - j3 + m] >> j3;
        ans += (row_bs & diag_bs).count();
        if ((row_bs & diag_bs).count())
          ;
      }
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> mat(n);
  for (int i = 0; i < n; ++i) cin >> mat[i];
  for (int it = 0; it < 4; ++it) {
    Solve(mat);
    mat = Rotate(mat);
  }
  cout << ans << endl;
  return 0;
}
