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