#include <bits/stdc++.h>
using namespace std;
long long h, w;
string s[301];
unordered_set<long long> hashes;
bool is_regular(pair<long long, long long> p1, pair<long long, long long> p2) {
  if (p1.first < p2.first) return true;
  if (p1.first > p2.first) return false;
  if (p1.second < p2.second) return true;
  if (p1.second > p2.second) return false;
  return true;
}
long long calc_hash(pair<long long, long long> p1,
                    pair<long long, long long> p2,
                    pair<long long, long long> p3) {
  if (!is_regular(p1, p2)) return calc_hash(p2, p1, p3);
  if (!is_regular(p2, p3)) return calc_hash(p1, p3, p2);
  return p1.first * 400 * 400 * 400 * 400 * 400 * 400 +
         p1.second * 400 * 400 * 400 * 400 * 400 +
         p2.first * 400 * 400 * 400 * 400 + p2.second * 400 * 400 * 400 +
         p3.first * 400 * 400 + p3.second;
}
bool is_placed(int x, int y) {
  if (x < 0 || x >= w || y < 0 || y >= h) return false;
  return s[y][x] == '#';
}
long long calc_dist(pair<long long, long long> p1,
                    pair<long long, long long> p2) {
  return abs(p1.first - p2.first) + abs(p1.second - p2.second);
}
void try_regist(pair<long long, long long> p1, pair<long long, long long> p2,
                pair<long long, long long> p3) {
  long long d1 = calc_dist(p1, p2);
  long long d2 = calc_dist(p1, p3);
  long long d3 = calc_dist(p3, p2);
  if (d1 != d2 || d2 != d3 || d3 != d1) return;
  long long hash = calc_hash(p1, p2, p3);
  auto it = hashes.find(hash);
  if (it != hashes.end()) return;
  hashes.emplace(hash);
}
int main(void) {
  cin >> h >> w;
  for (int i = (0), ilen = (h); i < ilen; ++i) {
    cin >> s[i];
  }
  for (int i = (-w - h), ilen = (w + h + 1); i < ilen; ++i) {
    vector<long long> xs;
    for (int x = (0), xlen = (w); x < xlen; ++x) {
      if (is_placed(x, i - x)) xs.push_back(x);
    }
    for (int j = (0), jlen = (xs.size()); j < jlen; ++j) {
      for (int k = (j + 1), klen = (xs.size()); k < klen; ++k) {
        pair<long long, long long> p1 = make_pair(xs[j], (long long)i - xs[j]);
        pair<long long, long long> p2 = make_pair(xs[k], (long long)i - xs[k]);
        for (int l = (0), llen = (p2.first - p1.first + 1); l < llen; ++l) {
          long long x = p1.first - (p2.first - p1.first) + l;
          long long y = p2.second - l;
          if (is_placed(x, y)) {
            pair<long long, long long> p3 = make_pair(x, y);
            try_regist(p1, p2, p3);
          }
          x = p2.first + (p2.first - p1.first) - l;
          y = p1.second + l;
          if (is_placed(x, y)) {
            pair<long long, long long> p3 = make_pair(x, y);
            try_regist(p1, p2, p3);
          }
        }
      }
    }
  }
  for (int i = (-w - h), ilen = (w + h + 1); i < ilen; ++i) {
    vector<long long> xs;
    for (int x = (0), xlen = (w); x < xlen; ++x) {
      if (is_placed(x, i + x)) xs.push_back(x);
    }
    for (int j = (0), jlen = (xs.size()); j < jlen; ++j) {
      for (int k = (j + 1), klen = (xs.size()); k < klen; ++k) {
        pair<long long, long long> p1 = make_pair(xs[j], (long long)i + xs[j]);
        pair<long long, long long> p2 = make_pair(xs[k], (long long)i + xs[k]);
        for (int l = (0), llen = (p2.first - p1.first + 1); l < llen; ++l) {
          long long x = p2.first + l;
          long long y = p1.second - (p2.first - p1.first) + l;
          if (is_placed(x, y)) {
            pair<long long, long long> p3 = make_pair(x, y);
            try_regist(p1, p2, p3);
          }
          x = p1.first - l;
          y = p2.second + (p2.first - p1.first) - l;
          if (is_placed(x, y)) {
            pair<long long, long long> p3 = make_pair(x, y);
            try_regist(p1, p2, p3);
          }
        }
      }
    }
  }
  int res = hashes.size();
  cout << res << endl;
  return 0;
}
