#include <bits/stdc++.h>
namespace loquat {
template <typename T, typename F = std::plus<T>>
class fenwick_tree {
 public:
  using value_type = T;

 private:
  std::vector<T> m_data;
  F m_func;

 public:
  explicit fenwick_tree(size_t n, const value_type& x = value_type(),
                        const F& f = F())
      : m_data(n + 1), m_func(f) {
    m_data[0] = value_type();
    for (size_t i = 1; i <= n; ++i) {
      m_data[i] = x;
      for (size_t j = i; (j & 1) == 0u; j >>= 1) {
        m_data[i] = m_func(m_data[j], m_data[i]);
      }
    }
  }
  value_type query(size_t i) const {
    value_type s = m_data[i];
    for (i -= i & -i; i > 0; i -= i & -i) {
      s = m_func(m_data[i], s);
    }
    return s;
  }
  void modify(size_t i, const value_type& x) {
    const auto n = m_data.size();
    for (++i; i < n; i += i & -i) {
      m_data[i] = m_func(m_data[i], x);
    }
  }
};
}  // namespace loquat
using namespace std;
using ll = long long;
ll solve(vector<string> field) {
  using fenwick_tree = loquat::fenwick_tree<int>;
  const int n = field.size(), m = field[0].size();
  for (int i = 0; i < n; ++i) {
    field[i] += string(n, '.');
  }
  const int max_k = min(n, m);
  vector<vector<fenwick_tree>> table(
      max_k, vector<fenwick_tree>(n + m, fenwick_tree(n)));
  for (int k = 0; k < max_k; ++k) {
    for (int x = 0; x < n + m; ++x) {
      for (int y = 0; y < n; ++y) {
        const int i0 = y, i1 = y + k;
        const int j0 = x - i0, j1 = x - i1;
        if (i1 >= n || j1 < 0) {
          continue;
        }
        if (field[i0][j0] != '#') {
          continue;
        }
        if (field[i1][j1] != '#') {
          continue;
        }
        table[k][x].modify(y, 1);
      }
    }
  }
  ll answer = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (field[i][j] != '#') {
        continue;
      }
      for (int k = 0; k < max_k; ++k) {
        const int y = i, x = j + i + k * 2;
        if (x >= n + m) {
          continue;
        }
        answer += table[k][x].query(min(n, i + k));
        answer -= table[k][x].query(y);
      }
    }
  }
  return answer;
}
vector<string> rotate(const vector<string>& a) {
  const int n = a.size(), m = a[0].size();
  vector<string> b(m, string(n, ' '));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      b[j][i] = a[i][m - 1 - j];
    }
  }
  return b;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<string> field(n);
  for (int i = 0; i < n; ++i) {
    cin >> field[i];
  }
  ll answer = 0;
  answer += solve(field);
  field = rotate(field);
  answer += solve(field);
  field = rotate(field);
  answer += solve(field);
  field = rotate(field);
  answer += solve(field);
  field = rotate(field);
  cout << answer << endl;
  return 0;
}
