#include<cstdio>
#include<iostream>
using namespace std;
int f[110][110][2];
int n,m;
char s[110][110]; 
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++) scanf("%s",s[i]+1);
	for (int i=0;i<=n;i++)for (int j=0;j<=m;j++) f[i][j][0]=f[i][j][1]=1e9;
	if (s[1][1]=='.') f[1][1][0]=0;
	else f[1][1][1]=1;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)
		{
			if (i==j&&i==1) continue;
			if (s[i][j]=='.') f[i][j][0]=min(min(f[i-1][j][0],f[i][j-1][0]),min(f[i-1][j][1],f[i][j-1][1]));
			else f[i][j][1]=min(min(f[i-1][j][0],f[i][j-1][0])+1,min(f[i-1][j][1],f[i][j-1][1]));
		}
	printf("%d",min(f[n][m][0],f[n][m][1]));
}
