#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int h,w;
    string s[100];
    cin>>h>>w;
    for(int i=0;i<h;i++)
        cin>>s[i];
    int dp[100][100];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            dp[i][j]=mod;
            if(i==0&&j==0)
                dp[i][j]=s[0][0]=='#';
            if(i!=0)
                dp[i][j]=min(dp[i-1][j]+(s[i][j]=='#'&&s[i-1][j]=='.'),dp[i][j]);
            if(j!=0)
                dp[i][j]=min(dp[i][j-1]+(s[i][j]=='#'&&s[i][j-1]=='.'),dp[i][j]);
        }
    }
    cout<<dp[h-1][w-1]<<endl;
}
