import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto s = readln.split.map!(to!int);
    auto H = s[0];
    auto W = s[1];
    auto A = H.iota.map!(_ => readln.chomp).array;
    auto B = H.iota.map!(_ => readln.chomp).array;
    H.iota.map!(i => W.iota.map!(j => A[i][j] != B[i][j]).sum).sum.writeln;
}

