#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using P = pair<int,int>;
int h, w, a[105][105];
char s[105][105];
int main(){
	scanf("%d%d", &h, &w);
	rep(i,h) scanf("%s", s[i]);
	rep(i,h) a[i][w] = 300;
	rep(j,w) a[h][j] = 300;
	for(int i=h-1; i>=0; i--) for(int j=w-1; j>=0; j--){
		a[i][j] = min(a[i+1][j]+(s[i][j]!=s[i+1][j]),a[i][j+1]+(s[i][j]!=s[i][j+1]));
		if(i==h-1&&j==w-1) a[i][j] = 0;
	}
	printf("%d\n", (a[0][0]+1+(s[0][0]=='#'))/2);
}