#include<bits/stdc++.h>
#define N 110
using namespace std;
int d[N][N];
char s[N][N];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%s",s[i]);
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(i||j) d[i][j]=10234567;
			if(i) d[i][j]=min(d[i][j],d[i-1][j]+(s[i][j]!=s[i-1][j]));
			if(j) d[i][j]=min(d[i][j],d[i][j-1]+(s[i][j]!=s[i][j-1]));
		}
	}
	int x=d[n-1][m-1];
	if(s[0][0]=='#') x++;
	if(s[n-1][m-1]=='#') x++;
	printf("%d\n",(x+1)/2);
	return 0;
}