#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;
void Solve(vector<string> mat) {
  int n = mat.size(), m = mat[0].size();
  for (int i1 = 0; i1 < n; ++i1) {
    for (int j1 = 0; j1 < m; ++j1) {
      if (mat[i1][j1] == '.') continue;
      for (int i2 = i1; i2 < n; ++i2)
        for (int j2 = j1 + 1; j2 < m; ++j2) {
          if (mat[i2][j2] == '.') continue;
          if (i1 == i2 && j1 == j2) continue;
          int perim = (abs(i1 - i2) + abs(j1 - j2));
          if (perim % 2) continue;
          int dj = j2 - j1;
          int di = 3 * perim / 2 - dj;
          int i3 = i1 + di;
          int j3 = j1 + perim - di;
          if (i3 < i2 || (i3 == i2 && j3 < j2) || j3 < 0 || i3 >= n) continue;
          if (mat[i3][j3] == '.') continue;
          if ((abs(i1 - i2) + abs(j1 - j2)) != (abs(i1 - i3) + abs(j1 - j3)))
            continue;
          if ((abs(i1 - i2) + abs(j1 - j2)) != (abs(i2 - i3) + abs(j2 - j3)))
            continue;
          if ((j3 == j1) || (i2 == i1))
            ans2 += 1;
          else
            ans += 1;
        }
    }
  }
}
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) {
    for (auto x : mat) cerr << x << endl;
    cerr << endl;
    Solve(mat);
    mat = Rotate(mat);
  }
  cout << ans + ans2 / 2 << endl;
  return 0;
}
