#include <bits/stdc++.h>
using namespace std;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
long long sss = 500;
pair<long long, long long> calc(vector<string> &s) {
  long long n = s.size();
  long long m = s[0].size();
  vector<long long> a[1000];
  for (long long i = 0; i < (long long)(n); ++i) {
    for (long long j = 0; j < (long long)(m); ++j) {
      if (s[i][j] == '#') {
        a[i - j + sss].push_back(j);
      }
    }
  }
  long long sm = 0;
  long long sm2 = 0;
  for (long long i = 0; i < 1000; i++) {
    long long ss = a[i].size();
    for (long long j = 0; j < ss; j++) {
      long long x = a[i][j];
      for (long long k = j + 1; k < ss; k++) {
        long long y = a[i][k];
        long long K = i;
        long long p = K + 2 * (x - y);
        long long q = K - 2 * (x - y);
        if (q > n + sss && p < 0) break;
        if (p >= 0) {
          sm += upper_bound((a[p]).begin(), (a[p]).end(), 2 * y - x) -
                lower_bound((a[p]).begin(), (a[p]).end(), y);
          sm2 += upper_bound((a[p]).begin(), (a[p]).end(), 2 * y - x) -
                 lower_bound((a[p]).begin(), (a[p]).end(), 2 * y - x);
          sm2 += upper_bound((a[p]).begin(), (a[p]).end(), y) -
                 lower_bound((a[p]).begin(), (a[p]).end(), y);
        }
        if (q < 1000) {
          sm += upper_bound((a[q]).begin(), (a[q]).end(), x) -
                lower_bound((a[q]).begin(), (a[q]).end(), 2 * x - y);
          sm2 += upper_bound((a[q]).begin(), (a[q]).end(), x) -
                 lower_bound((a[q]).begin(), (a[q]).end(), x);
          sm2 += upper_bound((a[q]).begin(), (a[q]).end(), 2 * x - y) -
                 lower_bound((a[q]).begin(), (a[q]).end(), 2 * x - y);
        }
      }
    }
  }
  return make_pair(sm, sm2);
}
signed main() {
  long long n, m;
  cin >> n >> m;
  vector<string> s(n);
  for (long long i = 0; i < (long long)(n); ++i) cin >> s[i];
  long long res = 0;
  auto x = calc(s);
  res += x.first;
  res -= x.second;
  vector<string> t(m);
  for (long long i = 0; i < (long long)(m); ++i) {
    for (long long j = 0; j < (long long)(n); ++j) {
      t[i].push_back('a');
    }
  }
  for (long long i = 0; i < (long long)(n); ++i) {
    for (long long j = 0; j < (long long)(m); ++j) {
      t[j][n - 1 - i] = s[i][j];
    }
  }
  x = calc(t);
  res += x.first;
  cout << res << endl;
  return 0;
}
