#include<bits/stdc++.h>
using namespace std;
const int N=105;
int n,m,f[N][N];
char s[N][N];
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)scanf("%s",s[i]+1);
	memset(f,0x3f,sizeof f);
	for (int i=n;i;i--)
		for (int j=m;j;j--)
			if (i==n&&j==m)f[i][j]=s[i][j]=='#';
			else f[i][j]=min(f[i+1][j]+((s[i][j]=='#')&&(s[i+1][j]!='#')),f[i][j+1]+((s[i][j]=='#')&&(s[i][j+1]!='#')));
	printf("%d\n",f[1][1]);
}
