#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct frep {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr frep(int l_, int r_): l(std::min(l_, r_)), r(r_) {}
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct brep {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr r, l;
  constexpr brep(int l_, int r_): r(std::max(l_, r_) - 1), l(l_ - 1) {}
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

template <class T>
inline T scan() {
  T res;
  std::cin >> res;
  return res;
}

#define DEBUG
#ifdef DEBUG
#include <iomanip>

void dbg_impl() {
  std::cerr << '\n';
}

template <class Head, class... Tail>
void dbg_impl(const Head& head, const Tail&... tail) {
  std::cerr << ' ' << head;
  dbg_impl(tail...);
}

struct dbg_setup {
  dbg_setup() {
    std::cerr << std::boolalpha;
    std::cerr << std::fixed << std::setprecision(5);
  }
} debug_setup;

#define debug(...)\
  do {\
    std::cerr << std::setw(5) << __LINE__ << "  | ";\
    std::cerr << "[" << #__VA_ARGS__ << "]:";\
    dbg_impl(__VA_ARGS__);\
  } while (false)

#else
#define debug(...) 0
#endif

int H, W;
bool grid[600][600];
int sum[601][601];

int calc(int a, int b, int c, int d) {
  return sum[c][d] - sum[a][d] - sum[c][b] + sum[a][b];
}

int main() {
  std::cin >> H >> W;
  for (int i: frep(0, H)) {
    for (int j: frep(0, W)) {
      char c;
      std::cin >> c;
      if (c == '#') {
        grid[W - 1 + i - j][i + j] = true;
        ++sum[W - 1 + i - j + 1][i + j + 1];
      }
    }
  }
  for (int i: frep(0, 601)) {
    for (int j: frep(0, 601)) {
      if (i > 0) sum[i][j] += sum[i - 1][j];
      if (j > 0) sum[i][j] += sum[i][j - 1];
      if (i > 0 && j > 0) sum[i][j] -= sum[i - 1][j - 1];
    }
  }
  long long count1 = 0, count2 = 0;
  for (int i: frep(0, 600)) {
    for (int j: frep(0, 600)) {
      if (!grid[i][j]) {
        continue;
      }
      for (int l = 1; i + l < 600 && j + l < 600; ++l) {
        if (grid[i + l][j]) {
          count1 += calc(i, j + l, i + l + 1, j + l + 1);
        }
        if (grid[i][j + l]) {
          count1 += calc(i + l, j, i + l + 1, j + l + 1);
        }
        if (grid[i + l][j] && grid[i][j + l]) {
          ++count2;
        }
      }
      for (int l = 1; i - l >= 0 && j + l < 600; ++l) {
        if (grid[i - l][j]) {
          count1 += calc(i - l, j + l, i + 1, j + l + 1);
        }
        if (grid[i][j + l]) {
          count1 += calc(i - l, j, i - l + 1, j + l + 1);
        }
        if (grid[i - l][j] && grid[i][j + l]) {
          ++count2;
        }
      }
      for (int l = 1; i + l < 600 && j - l >= 0; ++l) {
        if (grid[i + l][j]) {
          count1 += calc(i, j - l, i + l + 1, j - l + 1);
        }
        if (grid[i][j - l]) {
          count1 += calc(i + l, j - l, i + l + 1, j + 1);
        }
        if (grid[i + l][j] && grid[i][j - l]) {
          ++count2;
        }
      }
      for (int l = 1; i - l >= 0 && j - l >= 0; ++l) {
        if (grid[i - l][j]) {
          count1 += calc(i - l, j - l, i + 1, j - l + 1);
        }
        if (grid[i][j - l]) {
          count1 += calc(i - l, j - l, i - l + 1, j + 1);
        }
        if (grid[i - l][j] && grid[i][j - l]) {
          ++count2;
        }
      }
    }
  }
  std::cout << count1 / 2 - count2 << '\n';
  return 0;
}


Measured memory_bytes: 2048