// Slower C++ solution:
#include <bits/stdc++.h>



#define pii pair<int,int>

#define int long long

#define endl '\n'

#define all(a) a.begin(), a.end()

#define keepU(a) sort(all(a));a.erase(unique(all(a)), a.end())

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)



using namespace std;



// char mat[200][200];

string mat[200];

int cost[200][200], ans[200][200];

int n,m;



int oo = 1e15;





bool valid(int a, int b){

    if(a >= 1 and a <= n and b >= 1 and b <= m)return true;

    return false;

}



int32_t main()

{

    memset(ans, 0, sizeof ans);

    cin >> n >> m;

    for(int i = 1; i <= n;i++){

        for(int j = 1;j <= m;j++){

            char ch;

            cin >> ch;

            cost[i][j] = (ch=='#');

        }getchar();  

    }

    for(int i = 1; i <= n;i++){

        for(int j = 1; j <= m;j++){

            ans[i][j] = cost[i][j];

            if(i==1 and j==1)continue;

            if(i-1 < 1){

                if(cost[i][j-1] == 1 and cost[i][j] == cost[i][j-1])ans[i][j] = ans[i][j-1];

                else ans[i][j] += ans[i][j-1];

            }

            else if(j-1 < 1){

                if(cost[i-1][j] == 1 and cost[i][j] == cost[i-1][j])ans[i][j] = ans[i-1][j];

                else ans[i][j] += ans[i-1][j];

            }

            else{   

                int ans1 = ans[i][j];

                if(cost[i][j-1] == 1 and cost[i][j] == cost[i][j-1])ans1 = ans[i][j-1];

                else ans1 += ans[i][j-1];



                int ans2 = ans[i][j];

                if(cost[i-1][j] == 1 and cost[i][j] == cost[i-1][j])ans2 = ans[i-1][j];

                else ans2 += ans[i-1][j];



                ans[i][j] = min(ans1, ans2);

            }

        }

    }

    // for(int i = 1; i <= n;i++){

    //     for(int j = 1; j <= m;j++){

    //         cout << ans[i][j] << " ";

    //     }cout << endl;

    // }

    cout << ans[n][m] << endl;



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.173893302562224x):
#include<iostream>

#include<cstring>



using namespace std;



int H, W;

int grid[105][105], memo[105][105][2];



int findRoute(int row, int col, int black){

    if(memo[row][col][black] != -1) return memo[row][col][black];



    if(grid[row][col] == 1){

        if(row == H && col == W) return black;

        if(row == H) return memo[row][col][black] = findRoute(row, col+1, 0) + black;

        if(col == W) return memo[row][col][black] = findRoute(row+1, col, 0) + black;

        return memo[row][col][black] = min(findRoute(row+1, col, 0), findRoute(row, col+1, 0)) + black;

    }



    if(grid[row][col] == 0){

        if(row == H && col == W) return 0;

        if(row == H) return memo[row][col][black] = findRoute(row, col+1, 1) ;

        if(col == W) return memo[row][col][black] = findRoute(row+1, col, 1) ;

        return memo[row][col][black] = min(findRoute(row+1, col, 1), findRoute(row, col+1, 1)) ;

    }



    return 121;

}



int main(){

    memset(grid, 0, sizeof(grid));

    memset(memo, -1, sizeof(memo));

    cin >> H >> W;

    for(int i=1; i<=H; i++){

        for(int j=1; j<=W; j++){

            char c;

            cin >> c;

            if(c == '#') grid[i][j] = 1;

        }

    }



    cout << findRoute(1, 1, 1) << endl;

}