#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int H,W,M[102][102]={0};
	bool A[102][102]={0};
	char s;
	cin>>H>>W;
	for(int i=0;i<=H+1;i++)for(int j=0;j<=W+1;j++){
		if(i==0||i==H+1||j==0||j==W+1)M[i][j]=H*W;
		else{
			cin>>s;
			A[i][j]= (s!='#');
			if(i==1&&j==1)M[i][j]=!A[i][j];
			else M[i][j]=min(M[i-1][j]+(A[i-1][j]&&!A[i][j]),M[i][j-1]+(A[i][j-1]&&!A[i][j]));
		}
	}
	cout<<M[H][W];
	return 0;
}