#include <bits/stdc++.h>
long long dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
long long dy[8] = {1, 0, -1, 0, -1, 1, 1, -1};
using namespace std;
class pa3 {
 public:
  long long x, y, z;
  pa3(long long x = 0, long long y = 0, long long z = 0) : x(x), y(y), z(z) {}
  bool operator<(const pa3 &p) const {
    if (x != p.x) return x < p.x;
    if (y != p.y) return y < p.y;
    return z < p.z;
  }
  bool operator>(const pa3 &p) const {
    if (x != p.x) return x > p.x;
    if (y != p.y) return y > p.y;
    return z > p.z;
  }
  bool operator==(const pa3 &p) const {
    return x == p.x && y == p.y && z == p.z;
  }
  bool operator!=(const pa3 &p) const {
    return !(x == p.x && y == p.y && z == p.z);
  }
};
class pa4 {
 public:
  long long x;
  long long y, z, w;
  pa4(long long x = 0, long long y = 0, long long z = 0, long long w = 0)
      : x(x), y(y), z(z), w(w) {}
  bool operator<(const pa4 &p) const {
    if (x != p.x) return x < p.x;
    if (y != p.y) return y < p.y;
    if (z != p.z) return z < p.z;
    return w < p.w;
  }
  bool operator>(const pa4 &p) const {
    if (x != p.x) return x > p.x;
    if (y != p.y) return y > p.y;
    if (z != p.z) return z > p.z;
    return w > p.w;
  }
  bool operator==(const pa4 &p) const {
    return x == p.x && y == p.y && z == p.z && w == p.w;
  }
};
class pa2 {
 public:
  long long x, y;
  pa2(long long x = 0, long long y = 0) : x(x), y(y) {}
  pa2 operator+(pa2 p) { return pa2(x + p.x, y + p.y); }
  pa2 operator-(pa2 p) { return pa2(x - p.x, y - p.y); }
  bool operator<(const pa2 &p) const { return y != p.y ? y < p.y : x < p.x; }
  bool operator>(const pa2 &p) const { return x != p.x ? x < p.x : y < p.y; }
  bool operator==(const pa2 &p) const {
    return abs(x - p.x) == 0 && abs(y - p.y) == 0;
  }
  bool operator!=(const pa2 &p) const {
    return !(abs(x - p.x) == 0 && abs(y - p.y) == 0);
  }
};
string itos(long long i) {
  ostringstream s;
  s << i;
  return s.str();
}
long long gcd(long long v, long long b) {
  if (v > b) return gcd(b, v);
  if (v == b) return b;
  if (b % v == 0) return v;
  return gcd(v, b % v);
}
double distans(double x1, double y1, double x2, double y2) {
  double rr = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
  return sqrt(rr);
}
long long mod;
long long pr[500010];
long long inv[500010];
long long beki(long long wa, long long rr, long long warukazu) {
  if (rr == 0) return 1 % warukazu;
  if (rr == 1) return wa % warukazu;
  if (rr % 2 == 1)
    return ((long long)beki(wa, rr - 1, warukazu) * (long long)wa) % warukazu;
  long long zx = beki(wa, rr / 2, warukazu);
  return (zx * zx) % warukazu;
}
double bekid(double w, long long r) {
  if (r == 0) return 1.0;
  if (r == 1) return w;
  if (r % 2) return bekid(w, r - 1) * w;
  double f = bekid(w, r / 2);
  return f * f;
}
long long comb(long long nn, long long rr) {
  long long r = pr[nn] * inv[rr];
  r %= mod;
  r *= inv[nn - rr];
  r %= mod;
  return r;
}
vector<pair<long long, long long> > pos;
vector<long long> ve[610];
set<pair<long long, long long> > se;
long long ku(long long i, long long i1, long long i2) {
  if (i1 < 0 || i1 >= 610) return 0;
  if (i1 >= i2) return 0;
  long long r = lower_bound(ve[i].begin(), ve[i].end(), i2) -
                lower_bound(ve[i].begin(), ve[i].end(), i1);
  return r;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long h, w;
  cin >> h >> w;
  for (long long i = 0; i < h; i++) {
    string s;
    cin >> s;
    for (long long j = 0; j < w; j++) {
      if (s[j] == '#') pos.push_back(make_pair(i + j, i - j + 300));
    }
  }
  for (auto v : pos) {
    ve[v.first].push_back(v.second);
    se.insert(v);
  }
  for (long long i = 0; i < 610; i++) sort(ve[i].begin(), ve[i].end());
  long long iti = 0, ni = 0;
  for (long long i = 0; i < 610; i++) {
    if (ve[i].size() < 2) continue;
    long long l = ve[i].size();
    for (long long i1 = 0; i1 < l; i1++)
      for (long long i2 = i1 + 1; i2 < l; i2++) {
        long long d = ve[i][i2] - ve[i][i1];
        if (se.count(make_pair(i + d, ve[i][i1]))) ni++;
        if (se.count(make_pair(i - d, ve[i][i1]))) ni++;
        if (se.count(make_pair(i + d, ve[i][i2]))) ni++;
        if (se.count(make_pair(i - d, ve[i][i2]))) ni++;
        iti += ku(i + d, ve[i][i1] + 1, ve[i][i2]);
        iti += ku(i - d, ve[i][i1] + 1, ve[i][i2]);
      }
  }
  se.clear();
  for (auto &v : pos) {
    swap(v.first, v.second);
  }
  for (long long i = 0; i < 610; i++) ve[i].clear();
  for (auto v : pos) {
    ve[v.first].push_back(v.second);
    se.insert(v);
  }
  for (long long i = 0; i < 610; i++) sort(ve[i].begin(), ve[i].end());
  for (long long i = 0; i < 610; i++) {
    if (ve[i].size() < 2) continue;
    long long l = ve[i].size();
    for (long long i1 = 0; i1 < l; i1++)
      for (long long i2 = i1 + 1; i2 < l; i2++) {
        long long d = ve[i][i2] - ve[i][i1];
        if (se.count(make_pair(i + d, ve[i][i1]))) ni++;
        if (se.count(make_pair(i - d, ve[i][i1]))) ni++;
        if (se.count(make_pair(i + d, ve[i][i2]))) ni++;
        if (se.count(make_pair(i - d, ve[i][i2]))) ni++;
        iti += ku(i + d, ve[i][i1] + 1, ve[i][i2]);
        iti += ku(i - d, ve[i][i1] + 1, ve[i][i2]);
      }
  }
  cout << iti + ni / 2 << endl;
  return 0;
}
