#include <bits/stdc++.h>
using namespace std;

#define forn(i,n) for (int i = 0; i < int(n); i++)

const int INF = 1e9;

const int N = 111;

int n,m; 
string a[N];

int dp[N][N];
void relax(int i, int j, int ni, int nj) {
    int cost = a[ni][nj] == '#' && a[i][j] == '.';
    dp[ni][nj] = min(dp[ni][nj], dp[i][j] + cost);
}

int main() {
    cin >> n >> m;
    forn(i,n) cin >> a[i];

    forn(i,n) forn(j,m) {
        if (i == 0 && j == 0) dp[i][j] = a[i][j] == '#';
        else {
            dp[i][j] = N*N;
            if (i) relax(i-1,j,i,j);
            if (j) relax(i,j-1,i,j);
        }
    }
    cout << dp[n-1][m-1];

    return 0;
}
