#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios {
  fast_ios() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios_;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "[";
  for (auto v : vec) os << v << ",";
  os << "]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> &pa) {
  os << "(" << pa.first << "," << pa.second << ")";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, map<TK, TV> &mp) {
  os << "{";
  for (auto v : mp) os << v.first << "=>" << v.second << ",";
  os << "}";
  return os;
}
vector<pint> uv;
lint coun(const vector<int> &vec, int s, int t) {
  lint ans = distance(lower_bound(vec.begin(), vec.end(), s),
                      upper_bound(vec.begin(), vec.end(), t));
  ans += distance(upper_bound(vec.begin(), vec.end(), s),
                  lower_bound(vec.begin(), vec.end(), t));
  return ans;
}
lint solve(const vector<vector<int>> &w) {
  lint ans = 0;
  for (int x = (0), x_end_ = (601); x < x_end_; x++) {
    int n = w[x].size();
    for (int i = (0), i_end_ = (n); i < i_end_; i++)
      for (int j = (i + 1), j_end_ = (n); j < j_end_; j++) {
        int d = w[x][j] - w[x][i];
        if (x - d >= 0) {
          ans += coun(w[x - d], w[x][i], w[x][j]);
        }
        if (x + d < 601) {
          ans += coun(w[x + d], w[x][i], w[x][j]);
        }
      }
  }
  return ans;
}
vector<vector<int>> w1(601), w2(601);
int main() {
  int H, W;
  cin >> H >> W;
  for (int h = (0), h_end_ = (H); h < h_end_; h++) {
    string S;
    cin >> S;
    for (int w = (0), w_end_ = (W); w < w_end_; w++)
      if (S[w] == '#') {
        int u = h + w;
        int v = h - w + 300;
        uv.push_back(pint(u, v));
        w1[u].push_back(v);
        w2[v].push_back(u);
      }
  }
  for (auto &vec : w1) sort(vec.begin(), vec.end());
  for (auto &vec : w2) sort(vec.begin(), vec.end());
  lint ans1 = solve(w1);
  lint ans2 = solve(w2);
  cout << (ans1 + ans2) / 2 << endl;
}
