#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

queue<pair<int, int>> q;

ll H, W;
vector<vector<char>> s(105, vector<char>(105));
vector<vector<ll>> dp(105, vector<ll>(105));
vector<vector<ll>> origin(105, vector<ll>(105));

void dp_func() {
    FOR(i, 1, H) {
        FOR(j, 1, W) {
            if (s[i][j] == '#') {
                if (s[i - 1][j] == '#' && s[i][j - 1] == '#') {
                    dp[i][j] = min(dp[i - 1][j], dp[i][j - 1]);
                } else if (s[i - 1][j] == '.' && s[i][j - 1] == '#') {
                    dp[i][j] = min(dp[i - 1][j] + 1, dp[i][j - 1]);
                } else if (s[i - 1][j] == '#' && s[i][j - 1] == '.') {
                    dp[i][j] = min(dp[i - 1][j], dp[i][j - 1] + 1);
                } else {
                    dp[i][j] = min(dp[i - 1][j] + 1, dp[i][j - 1] + 1);
                }
            } else {
                dp[i][j] = min(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> H >> W;
    REP(i, H) {
        REP(j, W) { cin >> s[i][j]; }
    }

    /*
    bool before_black = false;
    REP(i, H) {
        if (dp[i][0] == '.') {
            if (i == 0) {
                dp[0][0] = 0;
            } else {
                dp[i][0] = dp[i - 1][0];
            }
            before_black = false;
        } else {  // '#'
            if (i == 0) {
                dp[0][0] = 1;
            } else {
                dp[i][0] = dp[i - 1][0] + abs(1 - before_black);
            }
            before_black = true;
        }
    }

    before_black = false;
    REP(i, W) {
        if (dp[0][i] == '.') {
            if (i == 0) {
                dp[0][0] = 0;
            } else {
                dp[0][i] = dp[0][i - 1];
            }
            before_black = false;
        } else {  // '#'
            if (i == 0) {
                dp[0][0] = 1;
            } else {
                dp[0][i] = dp[0][i - 1] + abs(1 - before_black);
            }
            before_black = true;
        }
    }*/

    bool before_flag = false;
    ll v = 0;
    REP(i, H) {
        if (s[i][0] == '.') {
            before_flag = false;
        } else {
            if (before_flag == false) v++;
            before_flag = true;
        }
        dp[i][0] = v;
    }

    before_flag = false;
    v = 0;
    REP(i, W) {
        if (s[0][i] == '.') {
            before_flag = false;
        } else {
            if (before_flag == false) v++;
            before_flag = true;
        }
        dp[0][i] = v;
    }


    /*
    REP(i, H) {
        REP(j, W) { cout << dp[i][j] << " "; }
        cout << endl;
    }
    */

    dp_func();
    cout << dp[H - 1][W - 1] << endl;

    return 0;
}


Measured memory_bytes: 512