#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;

#define un(x)           x.erase(unique(all(x)), x.end())
#define xx              first
#define yy              second
#define pb              push_back
#define all(v)          v.begin(),v.end()

#define D(x)            cerr << #x " = " << x << '\n'
#define DBG             cerr << "Hi!" << '\n'

#define CLR(a)          memset(a,0,sizeof(a))
#define SET(a)          memset(a,-1,sizeof(a))

//inline int setBit(int n,int pos) { return n = n | (1 << pos); }
//inline int resetBit(int n,int pos) { return n = n & ~(1 << pos); }
//inline bool checkBit(int n,int pos) { return (bool)(n & (1 << pos)); }

//int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1};
//int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1}; //Four & Eight Direction

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//unsigned int num = rng();
//shuffle(V.begin(), V.end(), rng);

/******************************************************************************************/

//const int MAX = 500010;
const int INF = 0x3f3f3f3f;
//const int MOD = 1000000007;


//inline int add(int a, int b) { return a + b >= MOD ? a + b - MOD : a + b; }
//inline int sub(int a, int b) { return a - b < 0 ? a - b + MOD : a - b; }
//inline int mul(int a, int b) { return (a * 1LL * b) % MOD; }

int n, m;
string s[105];

int dp[2][105][105];

int call(int flip, int r, int c) {
    if(r == n-1 and c == m-1) {
        if(flip) return (s[r][c] == '.');
        else return (s[r][c] == '#');
    }
    if(dp[flip][r][c] != -1) return dp[flip][r][c];

    int ret = INF;

    if(flip and s[r][c] == '.');
    else if(!flip and s[r][c] == '#');
    else {
        if(flip) {
            if(r + 1 < n) {
                if(s[r + 1][c] == '.') {
                    ret = min(ret, call(0, r + 1, c));
                }
                else {
                    ret = min(ret, call(1, r + 1, c));
                }
            }
            if(c + 1 < m) {
                if(s[r][c + 1] == '.') {
                    ret = min(ret, call(0, r, c + 1));
                }
                else {
                    ret = min(ret, call(1, r, c + 1));
                }
            }
        }
        else {
            if(r + 1 < n) {
                if(s[r + 1][c] == '.') {
                    ret = min(ret, call(0, r + 1, c));
                }
                else {
                    ret = min(ret, 1 + call(1, r + 1, c));
                }
            }
            if(c + 1 < m) {
                if(s[r][c + 1] == '.') {
                    ret = min(ret, call(0, r, c + 1));
                }
                else {
                    ret = min(ret, 1 + call(1, r, c + 1));
                }
            }
        }
    }
    return dp[flip][r][c] = ret;
}



int main() {
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> m;
    for(int i=0;i<n;i++) cin >> s[i];
    SET(dp);
    cout << min(call(0, 0, 0), 1 + call(1, 0, 0)) << endl;
    return 0;
}



Measured memory_bytes: 384