#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define INF 300
int main() {
  int h, w;
  cin >> h >> w;
  int d[h][w];
  char maze[h][w];
  rep(i,h)
    cin >> maze[i];
  rep(i, h)
    rep(j, w)
      d[i][j] = INF;
  d[0][0] = (maze[0][0] == '#' ? 1 : 0);
  rep(i,h)
  {
    rep(j,w)
    {
      if (i == 0 && j == 0) {
        continue;
      }
      if(i>0) d[i][j] = min(d[i][j], d[i - 1][j]+(maze[i][j] == '#' &&maze[i - 1][j] != maze[i][j]));
      if(j>0) d[i][j] = min(d[i][j], d[i][j - 1]+(maze[i][j] == '#' &&maze[i][j - 1] != maze[i][j]));
    }
  }
  cout << d[h - 1][w - 1];
}
