#include <bits/stdc++.h>
using namespace std;
double dot(complex<double> a, complex<double> b) {
  return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
  return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
  return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
  double cosine = dot(a, b) / (leng(a) * leng(b));
  double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
  double kaku = acos(cosine);
  if (sine <= 0) {
    kaku = 2 * 3.141592653589793 - kaku;
  }
  return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
  vector<int> ans;
  double now_minnest = a[0].real();
  int now_itr = 0;
  for (long long i = 0; i < a.size(); ++i) {
    if (now_minnest > a[i].real()) {
      now_minnest = a[i].real();
      now_itr = i;
    }
  }
  ans.push_back(now_itr);
  complex<double> ba(0, 1);
  while (true) {
    int now_go = 0;
    double now_min = 0;
    int starter = ans[ans.size() - 1];
    for (int i = 0; i < a.size(); ++i) {
      if (i != starter) {
        double goa = angles(ba, a[i] - a[starter]);
        if (goa > now_min) {
          now_min = goa;
          now_go = i;
        }
      }
    }
    if (now_go == ans[0]) break;
    ans.push_back(now_go);
    ba = complex<double>(a[now_go] - a[starter]);
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long dp[3000][3000] = {};
vector<int> grids[3000];
int main() {
  iostream::sync_with_stdio(false);
  long long h, w;
  cin >> h >> w;
  for (long long i = 0; i < h; ++i) {
    string a;
    cin >> a;
    for (long long q = 0; q < a.length(); ++q) {
      if (a[q] == '#') {
        dp[i + q][q]++;
        grids[i + q].push_back(q);
      }
    }
  }
  for (long long i = 0; i < 1000; ++i) {
    for (long long q = 1; q < 1000; ++q) {
      dp[i][q] += dp[i][q - 1];
    }
  }
  long long ans = 0;
  for (long long i = 0; i <= 1000; ++i) {
    sort(grids[i].begin(), grids[i].end());
    for (long long q = 0; q < grids[i].size(); ++q) {
      for (long long j = q + 1; j < grids[i].size(); ++j) {
        long long diff = grids[i][j] - grids[i][q];
        long long next_i = i - 2 * diff;
        if (next_i >= 0) {
          ans += dp[next_i][grids[i][j] - diff];
          long long now = grids[i][q] - diff - 1;
          if (now >= 0) {
            ans -= dp[next_i][now];
          }
        }
        next_i = i + 2 * diff;
        if (next_i >= 0) {
          ans += dp[next_i][grids[i][j] + diff];
          long long now = grids[i][q] + diff - 1;
          if (now >= 0) {
            ans -= dp[next_i][now];
          }
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
