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

int main()
{

  int H, W;
  cin >> H >> W;
  int count=0;

  char S[H][W];

  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      cin >> S[i][j];
    }
  }
  
 for (int i = 1; i < H-1; i++)
  {
    for (int j = 1; j < W-1; j++)
    {
      if (S[i][j] == '.')
      {
        if (S[i-1][j-1]=='#' && S[i-1][j]=='#' && S[i][j-1]=='#')
        {
          count ++;
        }

        if (S[i+1][j-1]=='#' && S[i+1][j]=='#' && S[i][j-1]=='#')
        {
          count ++;
        }

        if (S[i-1][j+1]=='#' && S[i-1][j]=='#' && S[i][j+1]=='#')
        {
          count ++;
        }

        if (S[i+1][j+1]=='#' && S[i+1][j]=='#' && S[i][j+1]=='#')
        {
          count ++;
        }
        
      }
      
    }
  }

  cout << 4 + 2*count << endl;

  

}

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

#define ll long long
#define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i)
#define rep(i, n) drep(i, 0, n - 1)
#define P pair<ll, ll>
#define all(a) (a).begin(), (a).end()

int main(){
    ll H, W;
    cin >> H >> W;

    vector<string> S(H);
    rep(i, H) cin >> S.at(i);

    ll ans = 0;
    ll dh[4] = {0, 1, 0, 1};
    ll dw[4] = {0, 0, 1, 1};
    rep(h, H-1){
        rep(w, W-1){
            ll count = 0;
            rep(i, 4){
                ll nh = h + dh[i];
                ll nw = w + dw[i];
                if(S[nh][nw] == '#') count++;
            }
            if(count == 1 || count == 3) ans++;
        }
    }

    cout << ans << endl;
}