#include <bits/stdc++.h>
using namespace std;
const int max_x = 303;
int calc(const vector<vector<int>>& elem_xy, const vector<vector<int>>& acc_xy,
         bool include_boundary) {
  const int delta = include_boundary ? 0 : 1;
  int ans = 0;
  for (int l = 0; l < 2 * max_x; ++l) {
    for (int i = 0; i < elem_xy[l].size(); ++i) {
      const int low_y = elem_xy[l][i];
      for (int j = i + 1; j < elem_xy[l].size(); ++j) {
        const int high_y = elem_xy[l][j];
        const int d = high_y - low_y;
        vector<int> test_ls = {l - d, l + d};
        for (const auto& test_l : test_ls) {
          if (test_l < 0 || test_l >= acc_xy.size()) {
            continue;
          }
          const int search_low_y = low_y - 1 + delta;
          const int search_high_y = high_y - delta;
          ans += acc_xy[test_l][search_high_y] - acc_xy[test_l][search_low_y];
        }
      }
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int h, w;
  cin >> h >> w;
  vector<string> p(h);
  for (int i = 0; i < h; ++i) {
    cin >> p[i];
  }
  vector<int> xs, ys;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (p[i][j] == '.') {
        continue;
      }
      int x = i + j;
      int y = i - j;
      xs.push_back(x);
      ys.push_back(y);
    }
  }
  const int n = xs.size();
  const int x_offset = *min_element(xs.begin(), xs.end());
  const int y_offset = *min_element(ys.begin(), ys.end());
  for (int i = 0; i < n; ++i) {
    xs[i] -= x_offset - 1;
    ys[i] -= y_offset - 1;
  }
  vector<vector<int>> acc_xy(2 * max_x, vector<int>(2 * max_x));
  vector<vector<int>> acc_yx(2 * max_x, vector<int>(2 * max_x));
  vector<vector<int>> elem_xy(2 * max_x);
  vector<vector<int>> elem_yx(2 * max_x);
  for (int i = 0; i < n; ++i) {
    acc_xy[xs[i]][ys[i]]++;
    acc_yx[ys[i]][xs[i]]++;
    elem_xy[xs[i]].push_back(ys[i]);
    elem_yx[ys[i]].push_back(xs[i]);
  }
  for (int i = 0; i < 2 * max_x; ++i) {
    for (int j = 1; j < max_x; ++j) {
      acc_xy[i][j] += acc_xy[i][j - 1];
      acc_yx[i][j] += acc_yx[i][j - 1];
    }
    sort(elem_xy[i].begin(), elem_xy[i].end());
    sort(elem_yx[i].begin(), elem_yx[i].end());
  }
  cout << calc(elem_xy, acc_xy, false) + calc(elem_yx, acc_yx, true) << endl;
  return 0;
}
