// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <cmath>

#include <cstdlib>

#include <ctime>

#include <cctype>

#include <cstring>

#include <iostream>

#include <sstream>

#include <string>

#include <list>

#include <vector>

#include <set>

#include <map>

#include <queue>

#include <stack>

#include <algorithm>

#include <functional>

#define int long long

#define lowbit(x) (x &(-x))

#define me(ar) memset(ar, 0, sizeof ar)

#define mem(ar,num) memset(ar, num, sizeof ar)

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

#define rep(i, a, n) for(int i = a; i <= n; i ++)

#define pre(i, n, a) for(int i = n; i >= a; i --)

#define IOS ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);

const int way[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

using namespace std;

typedef long long ll;

typedef pair<ll,ll> pll;

const int  INF = 0x3f3f3f3f3f3f3f3f;

const double PI = acos(-1.0);

const double EXP = 1e-8;

const ll   MOD = 1e9 + 7;

const int  N = 2e5 + 5;

int h, w;

char mp[105][105];

int dp[105][105];

signed main()

{

    IOS;

    cin >> h >> w;

    for(int i = 1; i <= h; i ++)

        for(int j = 1; j <= w; j ++)

            cin >> mp[i][j];

    if(mp[1][1] == '#') dp[1][1] = 1;

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

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

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

            dp[i][j] = INF;

            if(i > 1) dp[i][j] = min(dp[i][j], dp[i - 1][j] + (mp[i][j] == '#' && mp[i - 1][j] == '.'));

            if(j > 1) dp[i][j] = min(dp[i][j], dp[i][j - 1] + (mp[i][j] == '#' && mp[i][j - 1] == '.'));

        }

    }

    cout << dp[h][w] << endl;

    return 0;

}


// Fastest known solution for this problem: