#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int N,M;
vector<string> S,T;

int main(){
  cin>>N>>M;
  S.resize(N);
  T.resize(N);
  rep(i,N) cin>>S[i];
  rep(i,N) cin>>T[i];

  ll ans=0;
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      if(S[i][j]!=T[i][j]) ans++;
    }
  }

  cout<<ans<<endl;

  return 0;
}

