#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 998244353
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------
/*freopen("data.in"  ,"r",stdin);
    freopen("main.out","w",stdout);*/
int h,w;
char s[110][110];
int ans=0;
int dp[110][110];
bool color[110][110];
//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    cin>>h>>w;
    for(int i=0;i<=h;i++){
        s[i][0]='.';
    }
    for(int i=0;i<=w;i++){
        s[0][i]='.';
    }

    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cin>>s[i][j];
        }
    }
    for(int i=0;i<=h;i++){
        for(int j=0;j<=w;j++){
            dp[i][j]=IINF;
        }
    }

    dp[0][0]=0;

    int stx=1,sty=1;

    if(s[1][1]=='#'){
        dp[1][1]=1;
    }
    else dp[1][1]=0;
    color[1][1]=1;
    queue<Pin>q;
    q.push(mp(stx,sty));
    while(!q.empty()){
        Pin now=q.front();q.pop();
        int x=now.fi,y=now.se;
        if(s[x][y]=='.'){
            if(x>1)
            chmin(dp[x][y],dp[x-1][y]);
            if(y>1)
            chmin(dp[x][y],dp[x][y-1]);
        }
        else{
            if(x>1){
                if(s[x-1][y]=='.'){
                    chmin(dp[x][y],dp[x-1][y]+1);
                }
                else{
                    chmin(dp[x][y],dp[x-1][y]);
                }
            }
            if(y>1){
                if(s[x][y-1]=='.'){
                    chmin(dp[x][y],dp[x][y-1]+1);
                }
                else{
                    chmin(dp[x][y],dp[x][y-1]);
                }
            }
        }
        if(x==h&&y==w){
            break;
        }
        for(int i=0;i<2;i++){
            if(i==0){
                int nx=x+1;
                int ny=y;
                if(color[nx][ny])continue;
                if(nx<=h){
                    if(s[nx][ny]=='.'){
                        q.push(mp(nx,ny));
                        color[nx][ny]=1;
                        chmin(dp[nx][ny],dp[x][y]);
                    }
                    else{
                        if(s[x][y]=='.')
                            chmin(dp[nx][ny],dp[x][y]+1);
                        else chmin(dp[nx][ny],dp[x][y]);
                        color[nx][ny]=1;
                        q.push(mp(nx,ny));
                    }
                    //cout<<nx<<" "<<ny<<" "<<dp[nx][ny]<<endl;
                }
            }
            else{
                int nx=x;
                int ny=y+1;
                if(color[nx][ny])continue;
                if(ny<=w){
                    if(s[nx][ny]=='.'){
                        q.push(mp(nx,ny));
                        color[nx][ny]=1;
                        chmin(dp[nx][ny],dp[x][y]);
                    }
                    else{
                        if(s[x][y]=='.')
                            chmin(dp[nx][ny],dp[x][y]+1);
                        else chmin(dp[nx][ny],dp[x][y]);
                        q.push(mp(nx,ny));
                        color[nx][ny]=1;
                    }
                    //cout<<nx<<" "<<ny<<" "<<dp[nx][ny]<<endl;
                }
            }
        }
    }
    cout<<dp[h][w]<<Endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------


































Measured memory_bytes: 384