#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
	int n, m; cin >> n >> m;
	vector<string> A(n), B(n);
	for (auto& a : A) cin >> a;
	for (auto& b : B) cin >> b;
	int ans = 0;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
			if (A[i][j] != B[i][j]) ans++;
	cout << ans << endl;

	return 0;
}
