#include <bits/stdc++.h>
using namespace std;
void solve(long long H, long long W, vector<string> s) {
  map<int, vector<pair<int, int>>> mpx, mpy;
  for (int i = 0; i < H; ++i)
    for (int j = 0; j < W; ++j) {
      if (s[i][j] == '.') continue;
      int x = i + j, y = i - j;
      mpx[x].push_back(make_pair(x, y));
      mpy[y].push_back(make_pair(x, y));
    }
  set<vector<pair<int, int>>> st;
  for (auto p : mpx) {
    vector<pair<int, int>> v = p.second;
    for (int i = 0; i < v.size(); ++i)
      for (int j = i + 1; j < v.size(); ++j) {
        auto a = v[i];
        auto b = v[j];
        int d = abs(a.second - b.second);
        for (auto t : mpx[a.first - d]) {
          if (max(abs(t.second - a.second), abs(t.second - b.second)) > d) {
            continue;
          }
          vector<pair<int, int>> u;
          u.push_back(a);
          u.push_back(b);
          u.push_back(t);
          sort((u).begin(), (u).end());
          st.insert(u);
        }
        for (auto t : mpx[a.first + d]) {
          if (max(abs(t.second - a.second), abs(t.second - b.second)) > d) {
            continue;
          }
          vector<pair<int, int>> u;
          u.push_back(a);
          u.push_back(b);
          u.push_back(t);
          sort((u).begin(), (u).end());
          st.insert(u);
        }
      }
  }
  for (auto p : mpy) {
    vector<pair<int, int>> v = p.second;
    for (int i = 0; i < v.size(); ++i)
      for (int j = i + 1; j < v.size(); ++j) {
        auto a = v[i];
        auto b = v[j];
        int d = abs(a.first - b.first);
        for (auto t : mpy[a.second - d]) {
          if (max(abs(t.first - a.first), abs(t.first - b.first)) > d) {
            continue;
          }
          vector<pair<int, int>> u;
          u.push_back(a);
          u.push_back(b);
          u.push_back(t);
          sort((u).begin(), (u).end());
          st.insert(u);
        }
        for (auto t : mpy[a.second + d]) {
          if (max(abs(t.first - a.first), abs(t.first - b.first)) > d) {
            continue;
          }
          vector<pair<int, int>> u;
          u.push_back(a);
          u.push_back(b);
          u.push_back(t);
          sort((u).begin(), (u).end());
          st.insert(u);
        }
      }
  }
  cout << st.size() << endl;
}
int main() {
  long long W;
  long long H;
  scanf("%lld", &H);
  vector<string> s(H - 1 + 1);
  scanf("%lld", &W);
  for (int i = 0; i <= H - 1; i++) {
    cin >> s[i];
  }
  solve(H, W, s);
  return 0;
}
