local h,w=io.read("n","n","l")
local s={}
local dp={}
for i=1,h do
    local t=io.read()
    s[i]={}
    dp[i]={}
    for j=1,w do
        s[i][j]=t:sub(j,j)
        dp[i][j]=10000000000000000
    end
end

local dx={1,0}
local dy={0,1}

local function solve()
    if s[1][1]=="#" then
        dp[1][1]=1
    else
        dp[1][1]=0
    end

    for i=1,h do
        for j=1,w do
            for k=1,2 do
                local ni=i+dx[k]
                local nj=j+dy[k]
                if h>=ni and w>=nj then
                    local add=0
                    if s[ni][nj]=="#" and s[i][j]=="." then
                        add=1
                    end
                    if dp[ni][nj]>dp[i][j]+add then
                        dp[ni][nj]=dp[i][j]+add
                    end
                end
            end
        end
    end
    return dp[h][w]
end

print(solve())