import kotlin.math.min

fun main(args: Array<String>) {
    val (h, w) = readIntList()
    val s = List(h) { readString() }

    val dp = MutableList(h) { MutableList(w) { Int.MAX_VALUE } }
    dp[0][0] = if (s[0][0] == '#') {
        1
    } else {
        0
    }

    val dx = listOf(1, 0)
    val dy = listOf(0, 1)
    for (i in 0 until h) {
        for (j in 0 until w) {
            for (dir in 0..1) {
                val ni = i + dx[dir]
                val nj = j + dy[dir]
                
                if (ni >= h || nj >= w) continue
                
                val add = when {
                    s[ni][nj] == '#' && s[i][j] == '.' -> 1
                    else -> 0
                }
                dp[ni][nj] = min(dp[ni][nj], dp[i][j] + add)
            }
        }
    }
    println(dp[h - 1][w - 1])
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)