#include<cstdio>

int h, w;
char s[102][102];
int dp[102][102];

int min(int x, int y) {
  return x < y ? x : y;
}

int main() {
  scanf("%d %d", &h, &w);
  for (int i = 0; i < h; i++) {
    scanf("%s", s[i+1]+1);
  }
  for (int i = 0; i <= h; i++) {
    dp[i][0] = 100000;
  }
  for (int j = 0; j <= w; j++) {
    dp[0][j] = 100000;
  }
  dp[1][1] = s[1][1] == '#' ? 2 : 1;
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      if (i == 1 && j == 1) {
        continue;
      }
      dp[i][j] = min(dp[i-1][j]+(s[i][j]==s[i-1][j]?0:1), dp[i][j-1]+(s[i][j]==s[i][j-1]?0:1));
    }
  }
  printf("%d\n", dp[h][w]/2);
}
