#include <bits/stdc++.h>
using namespace std;
template <class T, size_t N>
ostream& operator<<(ostream& os, const array<T, N>& v);
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  bool f = 1;
  os << "[";
  for (auto& i : v) {
    if (!f) os << ", ";
    os << i;
    f = 0;
  }
  return os << "]";
}
template <class T, size_t N>
ostream& operator<<(ostream& os, const array<T, N>& v) {
  bool f = 1;
  os << "[";
  for (auto& i : v) {
    if (!f) os << ", ";
    os << i;
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const set<T1, T2>& v) {
  bool f = 1;
  os << "[";
  for (auto& i : v) {
    if (!f) os << ", ";
    os << i;
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const multiset<T1, T2>& v) {
  bool f = 1;
  os << "[";
  for (auto& i : v) {
    if (!f) os << ", ";
    os << i;
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2, class T3>
ostream& operator<<(ostream& os, const map<T1, T2, T3>& v) {
  bool f = 1;
  os << "[";
  for (auto& ii : v) {
    if (!f) os << ", ";
    os << "(" << ii.first << " -> " << ii.second << ") ";
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const multimap<T1, T2>& v) {
  bool f = 1;
  os << "[";
  for (auto& ii : v) {
    if (!f) os << ", ";
    os << "(" << ii.first << " -> " << ii.second << ") ";
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2>
ostream& operator<<(ostream& os, priority_queue<T1, T2> v) {
  bool f = 1;
  os << "[";
  while (!v.empty()) {
    auto x = v.top();
    v.pop();
    if (!f) os << ", ";
    f = 0;
    os << x;
  }
  return os << "]";
}
template <class T1, class T2>
void printarray(const T1& a, T2 sz, T2 beg = 0) {
  for (T2 i = beg; i < sz; i++) cout << a[i] << " ";
  cout << endl;
}
const long long mod = 1e9 + 7;
int N, M;
char s[500][500];
int p[1050][1050];
int S1[1050][1050], S2[1050][1050];
bool inbound(int y, int x) { return 1 <= x && x <= M && 1 <= y && y <= N; }
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 1; i <= N; i++) scanf("%s", s[i] + 1);
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++) {
      if (s[i][j] == '#') {
        p[i - j + 300][i + j] = 1;
      }
    }
  for (int i = 0; i <= 1000; i++) {
    for (int j = 1; j <= 1000; j++) S1[i][j] = S1[i][j - 1] + p[i][j];
  }
  for (int j = 0; j <= 1000; j++) {
    for (int i = 1; i <= 1000; i++) S2[i][j] = S2[i - 1][j] + p[i][j];
  }
  long long ans = 0;
  for (int i = N; i >= -M + 1; i--) {
    vector<pair<int, int> > v;
    for (int j = 1; j <= M && j + i - 1 <= N; j++)
      if (j + i - 1 >= 1) {
        int x = j, y = j + i - 1;
        if (s[y][x] == '#') v.push_back({y, x});
      }
    sort(v.begin(), v.end());
    for (int i = 0; i < (int)v.size(); i++)
      for (int j = i + 1; j < (int)v.size(); j++) {
        int y1 = v[i].first, x1 = v[i].second, y2 = v[j].first,
            x2 = v[j].second;
        int d = abs(x1 - x2) + abs(y1 - y2);
        int yl = v[i].first + d / 2, xl = v[i].second - d / 2;
        int yr = v[i].first - d / 2, xr = v[i].second + d / 2;
        ans +=
            S1[yl - xl + 300][yl + xl + d] - S1[yl - xl + 300][yl + xl + 0 - 1];
        ans +=
            S1[yr - xr + 300][yl + xl + d] - S1[yr - xr + 300][yl + xl + 0 - 1];
      }
  }
  for (int j = 1; j <= N + M; j++) {
    vector<pair<int, int> > v;
    for (int i = 1; i <= N && j - i + 1 >= 1; i++)
      if (j - i + 1 <= M) {
        int x = j - i + 1, y = i;
        if (s[y][x] == '#') v.push_back({y, x});
      }
    sort(v.begin(), v.end());
    for (int i = 0; i < (int)v.size(); i++)
      for (int j = i + 1; j < (int)v.size(); j++) {
        int y1 = v[i].first, x1 = v[i].second, y2 = v[j].first,
            x2 = v[j].second;
        int d = abs(x1 - x2) + abs(y1 - y2);
        int yl = v[i].first - d / 2, xl = v[i].second - d / 2;
        int yr = v[i].first + d / 2, xr = v[i].second + d / 2;
        ans +=
            S2[yl - xl + (d - 1) + 300][yl + xl] - S2[yl - xl + 300][yl + xl];
        ans +=
            S2[yr - xr + (d - 1) + 300][yr + xr] - S2[yr - xr + 300][yr + xr];
      }
  }
  printf("%lld\n", ans);
}
