#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX5 100005
#define MAX6 1000006
#define MAX7 10000007
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define sfs(a) scanf("%s", a)
#define sline(a) scanf("%[^\n]%*c", a);
#define pf(a) printf("%d\n", a)
#define pfl(a) printf("%lld\n", a)
#define pfs(a) printf("%s\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mod 1000000007
#define Mod 998244353
#define PI acos(-1.0)
#define eps 1e-9
#define mem(a, b) memset(a, b, sizeof(a))
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

const int N = MAX5;

int dx[] = {0, 0, 1, 1}; ///Up-down, Left-Right
int dy[] = {0, 1, 0, 1};

string s[15];

int check(int i, int j)
{
    int cnt = 0;
    for(int d = 0; d < 4; d++) {
        cnt += (s[i + dx[d]][j + dy[d]]=='#');
    }
    return (cnt & 1);
}

int main()
{
    //#ifndef ONLINE_JUDGE
    //    freopen("in.txt","r",stdin);
    //    freopen("out.txt","w",stdout);
    //#endif

    FASTIO;
    int n, m;
    cin>>n>>m;
    for(int i = 0; i < n; i++) cin>>s[i];
    int res = 0;
    for(int i = 0; i < n - 1; i++) {
        for(int j = 0; j < m - 1; j++) {
            res += check(i, j);
        }
    }
    cout<<res<<endl;
    
    return 0;
}

//https://atcoder.jp/contests/abc191/tasks/abc191_c
#include<iostream>
#include<iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>


using namespace std;
#define ll long long int
#define vl vector<ll>
#define vvll vector<vl>
#define vpll vector<pair<ll, ll>>
#define sz(a) (ll)a.size()
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb(a) push_back(a)
#define MAX 100000009


#define FOR(i, a, b) for (ll i = (a); i <= (b); ++i)
#define ROF(i, a, b) for (ll i = (a); i >= (b); --i)


#define fastIO ios_base::sync_with_stdio(false), cin.tie(NULL)


bool comp(const pair<ll, ll> &a, const pair<ll, ll> &b)
{
   return a.second > b.second;
}


ll _ceil(ll a, ll b) { return (a + b - 1) / b; }


int main()
{
   ll t=1;
   //cin>>t;
   while(t--)
   {
      ll h,w;
      cin>>h>>w;
      string line;
      vector<vector<bool>>grid(h,vector<bool>(w));
      FOR(i,0,h-1)
      {   
          cin>>line;
          FOR(j,0,w-1)
          {
            grid[i][j] = line[j] == '#';
          }
      }
      ll ans = 0,sum = 0;
      FOR(i,0,h-2)
      {
          FOR(j,0,w-2)
          {
              sum = 0;
              sum^=grid[i][j];
              sum^=grid[i+1][j];
              sum^=grid[i][j+1];
              sum^=grid[i+1][j+1];
              ans+=sum;
          }
      }
      cout<<ans<<"\n";
   }
}
