#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)
int dp[100][100];

int main(){
  int h,w;cin>>h>>w;
  vector<string> s(h);
  REP(i,h) cin>>s.at(i);
  REP(i,h)REP(j,w) dp[i][j]=0;
  dp[0][0]=(s.at(0).at(0)=='#'?1:0);
  REP(i,h)REP(j,w){
      if(!i&&!j) continue;
      int fromU=1e9,fromL=1e9;
      if(i>0) fromU=dp[i-1][j]+(s.at(i).at(j)!=s.at(i-1).at(j)?1:0);
      if(j>0) fromL=dp[i][j-1]+(s.at(i).at(j)!=s.at(i).at(j-1)?1:0);
      dp[i][j]+=min(fromU,fromL);
  }
  /*REP(i,h){
    REP(j,w) cout<<dp[i][j]<<" ";
    cout<<endl;
  }*/
  
  cout<<(dp[h-1][w-1]+1)/2;
}