#include <bits/stdc++.h>
using namespace std;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (const auto &v : vec) {
    os << v << ",";
  }
  os << "]";
  return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
void solve() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  for (int i = 0; i < H; i++) {
    cin >> S[i];
  }
  long long cnt = 0;
  map<pair<int, int>, int> rot;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S[i][j] == '.') continue;
      int x = i + j;
      int y = i - j;
      rot[{y, x}] = 1;
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S[i][j] == '.') continue;
      int x = i + j;
      int y = i - j;
      for (int k = 1; k <= H + W - 2; k++) {
        cnt += rot[{y - k, x}] * rot[{y, x - k}];
        cnt += rot[{y, x - k}] * rot[{y + k, x}];
        cnt += rot[{y + k, x}] * rot[{y, x + k}];
        cnt += rot[{y, x + k}] * rot[{y - k, x}];
      }
    }
  }
  cout << cnt << endl;
}
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}
