#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

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;
}
#define int long long

pair<int,int> calc(vector<string>&s){
    int n = s.size();
    int m = s[0].size();
    vector<vector<int> > a(n+1,vector<int>(m+1));
    rep(i,n){
        rep(j,m){
            if(s[i][j]=='#'){
                a[i][j]++;
            }
        }
    }
    rep(i,n){
        rep(j,m){
            a[i+1][j+1] += a[i][j];
        }
    }
    ll sm = 0;
    ll sm2 = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(s[i][j]!='#')continue;
            for(int k=1;k<m;k++){
                if(j+k>=m||i+k>=n)continue;
                if(s[i+k][j+k]!='#')continue;
                if(i+k<n&&j-k>=0){
                    if(s[i+k][j-k]=='#')sm2++;
                }
                if(i+2*k<n){
                    if(s[i+2*k][j]=='#')sm2++;
                }
                if(i-k>=0&&j+k<m){
                    if(s[i-k][j+k]=='#')sm2++;
                }
                if(j+2*k<m){
                    if(s[i][j+2*k]=='#')sm2++;
                }
                if(j+2*k<m){
                    sm += a[i][j+2*k];
                }else{
                    if(i-j-2*k+m-1>=0&&i-j-2*k+m-1<=n-1){
                        sm += a[i-j-2*k+m-1][m-1];
                    }
                }
                if(i-k-1>=0){
                    sm -= a[i-k-1][j+k-1];
                }
                if(i+2*k<n){
                    sm += a[i+2*k][j];
                }else{
                    if(n-1-(i+2*k-j) >= 0&& n-1-(i+2*k-j) <= m-1){
                        sm += a[n-1][n-1-(i+2*k-j)];
                    }
                }
                if(j-k-1>=0){
                    sm -= a[i+k-1][j-k-1];
                }
            }
        }
    }
    return make_pair(sm,sm2);
}
signed main(){
    int n,m;
    cin >> n >> m;
    vector<string> s(n);
    rep(i,n)cin >> s[i];
    int res = 0;
    auto x = calc(s);
    res += x.first;
    res -= x.second;
    // cerr << x.first << " " << x.second << endl;
    vector<string> t(m);
    rep(i,m){
        rep(j,n){
            t[i].push_back('a');
        }
    }
    rep(i,n){
        rep(j,m){
            t[j][n-1-i] = s[i][j];
        }
    }
    x = calc(t);
    res += x.first;
    // cerr << x.first << " " << x.second << endl;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1208