#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
//typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

template<typename T>
vector<vector<T>> rotate(const vector<vector<T>> &ban, int k){
  // k回反時計回りに90度回転させる 負の数でもok
  int n = ban.size();
  int m = ban[0].size();

  k = ((k%4)+4)%4;

  vector<vector<T>> res;
  if(k%2){
    res.assign(m, vector<T>(n));
  }else{
    res.assign(n, vector<T>(m));
  }

  if(k==0){
    REP(i, n){
      REP(j, m){
        res[i][j] = ban[i][j];
      }
    }
  }else if(k==1){
    REP(i, m){
      REP(j, n){
        res[i][j] = ban[j][m-1-i];
      }
    }
  }else if(k==2){
    REP(i, n){
      REP(j, m){
        res[i][j] = ban[n-1-i][m-1-j];
      }
    }
  }else{
    REP(i, m){
      REP(j, n){
        res[i][j] = ban[n-1-j][i];
      }
    }
  }
  return res;
}

ll count_triple(vvl &S, bool flag){
    ll H = S.size();
    ll W = S[0].size();

    vvl C(H, vl(W+1, 0));
    REP(i, H){
        REP(j, W){
            C[i][j+1] = C[i][j] + S[i][j];
        }
    }

    // cout << S << endl;
    // cout << C << endl;

    ll res = 0;
    REP(i, H){
        for(int j=0;j<W;j++){
            for(int k=j+1;k<W;k++){
                if(S[i][j]==1 and S[i][k] == 1){
                    ll d = k - j;
                    ll left = (flag ? j : j+1);
                    ll right = (flag ? k : k-1);
                    if(i-d>=0) res += C[i-d][right+1] - C[i-d][left];
                    if(i+d<H) res += C[i+d][right+1] - C[i+d][left];
                }
            }
        }
    }

    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll H, W;
    cin >> H >> W;

    vector<string> s(H);
    REP(i, H) cin >> s[i];

    ll res = 0;

    const ll MA = 300;
    vvl S(2*MA, vl(2*MA, 0));
    REP(i, H){
        REP(j, W){
            if(s[i][j] == '#') S[i+j][i-j+MA] = 1;
        }
    }

    res += count_triple(S, true);
    auto R = rotate(S, 1);
    res += count_triple(R, false);

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 11988