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

int solve(int h, int w, vector<string> s) {
    int res = 0;
    for(int i = 0; i < h - 1; i++) {
        for(int j = 0; j < w - 1; j++) {
            int black = 0;
            if(s[i][j] == '#')
                black++;
            if(s[i][j + 1] == '#')
                black++;
            if(s[i + 1][j] == '#')
                black++;
            if(s[i + 1][j + 1] == '#')
                black++;
            if(black == 1 || black == 3) {
                //cout << "i: " << i << " J " << j << " -> " << black <<endl;
                res++;
            }
        }
    }
    return res;
}

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i = 0; i < h; i++) {
        cin >> s[i];
    }
    cout << solve(h, w, s) << endl;
}
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)

int main(){
  int h,w,ans=0;
  vector<string> s(11);
  cin>>h>>w;
  REP(i,h) cin>>s.at(i);
  REP(i,h) REP(j,w){
    if(s.at(i).at(j)=='#'){
      int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
      bool f[4]={0,0,0,0};
      REP(k,4){
        if(s.at(i+dy[k]).at(j+dx[k])=='.'){
          ans++;
          f[k]=1;
        }
      }
      if(s.at(i).at(j+1)=='#') REP(k,4){
        if(s.at(i+dy[k]).at(j+1+dx[k])=='.'&&f[k]) ans--;
      }
      if(s.at(i+1).at(j)=='#') REP(k,4){
        if(s.at(i+1+dy[k]).at(j+dx[k])=='.'&&f[k]) ans--;
      }
    }
  }
  cout<<ans<<endl;
}
