#include <bits/stdc++.h>
using namespace std;
const int MAX = 500;
const long long base = 1e9 + 7;
struct Node {
  int x, y, w;
};
string terr[MAX];
int H, W;
using Point = pair<int, int>;
inline bool iscoin(Point& p0, Point& p1) {
  int x = p0.first + p1.first;
  if (x < 0 || x >= H) return false;
  int y = p0.second + p1.second;
  if (y < 0 || y >= W) return false;
  if (terr[x][y] == '.') return false;
  return true;
}
void solve() {
  long long result = 0;
  cin >> H >> W;
  for (int i = 0; i < H; ++i) {
    cin >> terr[i];
  }
  for (int dis = 2; dis < 2 * (H + W) / 3 + 3; dis += 2) {
    vector<Point> za;
    for (int a = 0; a <= dis; ++a) {
      int b = dis - a;
      za.push_back({a, b});
      if (a && b) za.push_back({a, -b});
    }
    sort(za.begin(), za.end());
    vector<Point> zt1, zt2;
    for (int i = 0; i < za.size(); ++i) {
      for (int j = i + 1; j < za.size(); ++j) {
        auto& p0 = za[i];
        auto& p1 = za[j];
        int d = abs(p0.first - p1.first) + abs(p0.second - p1.second);
        if (d == dis) {
          zt1.push_back(p0);
          zt2.push_back(p1);
        }
      }
    }
    int tl = zt1.size();
    for (int x = 0; x < H; ++x) {
      for (int y = 0; y < W; ++y) {
        if (terr[x][y] == '.') continue;
        for (int g = 0; g < tl; ++g) {
          Point p{x, y};
          if (iscoin(p, zt1[g]) && iscoin(p, zt2[g])) {
            result += 1;
          }
        }
      }
    }
  }
  cout << result << endl;
}
int main() {
  const int inId = 0;
  const int outId = 0;
  if (inId > 0) {
    cerr << "redirect stdin to input " << inId << endl;
    string s = "input";
    s += to_string(inId);
    s += ".txt";
    auto r = freopen(s.c_str(), "r", stdin);
    if (r == nullptr) {
      cerr << "invalid input file " << s;
    }
  }
  if (outId > 0) {
    cerr << "redirect stdout to stdout " << outId << endl;
    string s = "stdout";
    s += to_string(outId);
    s += ".txt";
    auto r = freopen(s.c_str(), "w", stdout);
    if (r == nullptr) {
      cerr << "invalid output file " << s;
    }
  }
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  solve();
}
