#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MOD int(1e9+7)
#define INF int(1e9+7)
#define LINF ll(1e18+7)
#define PI acos(-1)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define P pair<ll,ll>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

int h,w;
char grid[15][15];
int di[]={0,1,0,1};
int dj[]={0,0,1,1};

int main(){
  cin>>h>>w;
  rep(i,h)rep(j,w)cin>>grid[i][j];
  int ans=0;
  rep(i,h)rep(j,w){
    int cnt=0;
    rep(ind,4){
      if(grid[i+di[ind]][j+dj[ind]]=='#') cnt++;
    }
    ans += cnt%2;
  }
  cout<<ans<<endl;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, m;
    cin >> n >> m;
    vector<string> s(n);
    for (int i = 0; i < n; ++i) cin >> s[i];
    int ans = 0;
    for (int j = 1; j < m; ++j)
        if (s[0][j - 1] != s[0][j])
            ++ans;
    for (int i = 1; i < n; ++i)
        for (int j = 1; j < m; ++j)
            if (s[i][j - 1] != s[i][j] && (s[i - 1][j - 1] != s[i][j - 1] || s[i - 1][j] != s[i][j]))
                ++ans;
    for (int i = 1; i < n; ++i)
        if (s[i][0] != s[i - 1][0])
            ++ans;
    for (int j = 1; j < m; ++j)
        for (int i = 1; i < n; ++i)
            if (s[i - 1][j] != s[i][j] && (s[i - 1][j - 1] != s[i - 1][j] || s[i][j - 1] != s[i][j]))
                ++ans;
    for (int i = 1; i < n; ++i)
        if (s[i - 1][0] != s[i][0]) {
            ++ans;
            break;
        }
    for (int i = 1; i < n; ++i)
        if (s[i - 1][m - 1] != s[i][m - 1]) {
            ++ans;
            break;
        }
    for (int j = 1; j < m; ++j)
        if (s[0][j - 1] != s[0][j]) {
            ++ans;
            break;
        }
    for (int j = 1; j < m; ++j)
        if (s[n - 1][j - 1] != s[n - 1][j]) {
            ++ans;
            break;
        }
    cout << ans;
}