object Main extends App {
  import scala.io.StdIn._
  val Array(n, m) = readLine.trim.split(' ').map(_.toInt)
  val a = Array.fill(n){readLine.trim}
  val b = Array.fill(n){readLine.trim}
  println(
    (0 until n).map(y ⇒ (0 until m).count(x ⇒ a(y)(x) != b(y)(x))).sum
  )
}

