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

#define _GLIBCXX_DEBUG

using LL = long long;
using VI = vector<int>;
using VS = vector<string>;
using VLL = vector<LL>;
using VC = vector<char>;
using VD = vector<double>; 
using PII = pair<int, int>;
using PSS = pair<string, string>;
using PIS = pair<int , string>;
using PSI = pair<string, int>;
using PLL = pair<LL, LL>;
using PCC = pair<char, char>;
using VVI = vector<VI>;
using VVS = vector<VS>;
using VVLL = vector<VLL>;
using VVC = vector<VC>;
using VVD = vector<VD>;
using VPII = vector<PII>;
using VPSS = vector<PSS>;
using VPIS = vector<PIS>;
using VPLL = vector<PLL>;

template<class T> void chmin(T &a, T b)
{
  if(a > b) a = b;
}
template<class T> void chmax(T &a, T b)
{
  if(a < b) a = b;
}

  //const double PI = 3.141592653589793;
  //LL INF = 1LL << 60;

//-----------------------------------------

 
int main()
{
  cout << fixed << setprecision(12);
  
  int H, W;
  cin >> H >> W;
  VVC S(H, VC(W));
  for(int i = 0; i < H; i++)
  {
    for(int j = 0; j < W; j++)
    {
      cin >> S[i][j];
    }
  }
  
  int n = 0;
  for(int i = 0; i < H - 1; i++)
  {
    for(int j = 0; j < W - 1; j++)
    {
      int cnt = 0;
      if(S[i][j] == '#') cnt++;
      if(S[i + 1][j] == '#') cnt++;
      if(S[i][j + 1] == '#') cnt ++;
      if(S[i + 1][j + 1] == '#') cnt++;
      if(cnt == 1 || cnt == 3) n++;
    }
  }
  
  cout << n << endl;
  
  
  
  
  
  
  return 0;
}  
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isPossible(x) printf("%s\n",(x) ? "Possible" : "Impossible")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
// #define INF (1<<9+9)
const int INF = 0x3fffffff;
// const long long INF = 1LL<<50;

#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define pie 3.14159265358979323846

using namespace std;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)998244353; 
// const int mod =(int)998244353;
const int mod =(int)1e9+7;

const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(a<0)a=-a;
    if(b<0)b=-b;
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
  if(a<0)a=-a;
  if(b<0)b=-b;
    ll g;g=gcd(a,b);
    return b/g*a;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
//int N, M, K, T, H, W, L, R;
// long long int N, M, K, T, H, W, L, R
ll RS(ll N,ll P,ll m){
    if(P==0){
        return 1;
    }else{
        if(P%2==0){
            ll t=RS(N,P/2,m);
            return t*t%m;
        }else{
            return N*RS(N,P-1,m)%m;
        }
    }
}
struct BIT{
  private:
    vector<int> bit;
    int N;
  public:
    BIT(int size){
      N=size;
      bit.resize(N+1);
    }
    void add(int a,int w){
      for(int x=a;x<=N;x+=(x&-x)){
        bit[x]+=w;
      }
    }
    int sum(int a){
      int ret=0;
      for(int x=a;x>0;x-=(x&-x))ret+=bit[x];
      return ret;
    }
};
int main() {
  ios::sync_with_stdio(false);
  int H,W;
  cin>>H>>W;
  vector<string>S(H);
  REP(i,H)cin>>S[i];
  int ans=0;
  int dh[]={0,0,1,1};
  int dw[]={0,1,0,1};
  REP(ih,H-1){
      REP(iw,W-1){
          int cnt=0;
          REP(i,4){
              if(S[ih+dh[i]][iw+dw[i]]=='#')cnt++;
          }
          if(cnt&1)ans++;
      }
  }
  cout<<ans<<endl;

  return 0;
} 
  
