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

int inf = 1001001001;
ll INF = 1001001001001001001;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define rep(i, n) FOR(i, 0, n)
#define all(x) x.begin(), x.end()
#define pb push_back
#define pf push_front
ll MOD = 1000000007;
using P = pair<ll, ll>;



int main() {
    int H, W;cin >> H >> W;
    string s[15];
    rep(i, H) cin >> s[i];
    int ans = 0;
    rep(i, H-1) rep(j, W-1) {
        int cnt = 0;
        if (s[i][j]=='#') cnt++;
        if (s[i][j+1]=='#') cnt++;
        if (s[i+1][j]=='#') cnt++;
        if (s[i+1][j+1]=='#') cnt++;
        if (cnt == 1||cnt == 3) ans++;

        
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{
  int h,w,ans;
  cin>>h>>w;
  ans=(h-1)*(w-1);
  vector<vector<char>> a(h,vector<char>(w));
  for(int i=0;i<h;i++)
  {
    for(int j=0;j<w;j++)
    {
      cin>>a.at(i).at(j);
    }
  }
  for(int i=0;i<h-1;i++)
  {
    for(int j=0;j<w-1;j++)
    {
      int black=0;
      if(a.at(i).at(j)=='#')
        black++;
      if(a.at(i+1).at(j)=='#')
        black++;
      if(a.at(i).at(j+1)=='#')
        black++;
      if(a.at(i+1).at(j+1)=='#')
        black++;
      if(black==0||black==2||black==4)
        ans--;
    }
  }
  cout<<ans<<endl;
}