#include <iostream>
#include <vector>
using namespace std;

int main(){
  int N, M;
  cin >> N >> M;
  vector<string> A(N), B(N);
  for(int i = 0; i < N; ++i)
    cin >> A[i];
  for(int i = 0; i < N; ++i)
    cin >> B[i];
  int ans = 0;
  for(int i = 0; i < N; ++i)
    for(int j = 0; j < M; ++j)
      ans += (A[i][j] != B[i][j]);
  cout << ans << endl;
}

