///Created: 2020-07-09-01.58
    /*****************************************************************\
         IN THE NAME OF ALLAH, MOST GRACIOUS AND MOST MERCIFUL       |
    |                                                                 |
    |     Author     : Mahabub Rahman                                 |
    |     Email      : mahabubrahman618@gmail.com                     |
    |     University : Comilla University, Bangladesh              |
    |                  Department of Computer Science & Engineering   |
    \*****************************************************************/


    /*...................................Data_Types............................................*/
    #include<bits/stdc++.h>

    using namespace std;
    #define FastIO ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
    #define       ll                  long long int
    #define       ull                  unsigned long long int
    #define       veci                 vector<int>
    #define       vecc                 vector<char>
    #define       vecs                 vector<string>
    #define       vecl                 vector<long long int>
    #define       vecp                 vector<  pair<int,int> >
    #define       mapstrint            map< string , int >
    #define       mapstrstr            map< string , string >
    #define       mapint               map< int, int >
    #define       pb                   push_back
    #define       newline cerr << endl
    #define       debug(x) cerr << #x << " = " << x << endl
    #define       pob                  pop_back
    #define       mp                   make_pair
    #define       pii                  pair<int, int>
    #define       F                    first
    #define       S                    second
    #define       sc(x)                scanf("%d",&x)
    #define       sc2(xx,zz)           scanf("%d %d",&xx,&zz)
    #define       scl(x)               scanf("%lld",&x)
    #define       scl2(xx,zz)          scanf("%lld %lld",&xx,&zz)
    #define       pf                   printf
    #define       min3(a,b,c)          min(a,b<c?b:c)
    #define       max3(a,b,c)          max(a,b>c?b:c)
    #define       all(v)               v.begin(), v.end()
    //#define f(x) (64 - __builtin_clzll(x))
    ////============ CONSTANT ===============////
    #define mx9   1000000007
    #define mx7   10000007
    #define mx6   2000006
    #define mx5   200005
    #define inf   1<<30                                           //infinity value
    #define eps   1e-9
    #define mod   mx9
    ////=====================================////

    long double PI = acosl(-1);
    bool compare_int(int a, int b) //This function is use for descending order.
    {
        return (a>b);
    }
    bool compare_string (string a, string b)
    {
        return a.size() < b.size();
    }
    bool compare_pair(const pair<int,int> &a,
                  const pair<int,int> &b)
    {
        if(a.second==b.second) return a.first<b.first;
        else return (a.second > b.second);
    }
    bool cmp(pair<string ,int > x , pair<string ,int > y)
    {
        return x.second < y.second;
    }
    int fx[9] = { 0 , 1 , -1 , 1 , -1 , -1 , 1 , 1 } ;
    int fy[9] = { 1 , 0 , 0 , 0 , -1 , 1 , -1 , 1 } ;
    /*ll fact(ll n)
    {
        if(n==0 || n==1) return 1;
        else return n*fact(n-1);
    }*/
    void NA()
    {
        cout << "NO" << endl;
        exit(0);
    }
    void YA()
    {
        cout << "YES" << endl;
        exit(0);
    }
/*----------------------Graph Moves----------------*/
//const int fx[]= {+1,-1,+0,+0};
//const int fy[]= {+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N | (1<<pos);}
//int reset(int N,int pos){return N= N & ~(1<<pos);}
//bool check(int N,int pos){return (bool)(N & (1<<pos));}
/*------------------------------------------------*/

    ////=================FUNCTION=====================////
    /*bool check(int n)
    {
        if(n==1) return false;
        for(int i=2; i<=sqrt(n); i++)
        {
            if(n%i==0)
            {
                return false;
            }
        }
        return true;
    }*/
    /*ll bigmod(ll a, ll b, ll m)
    {
        if(b==0)return 1%m;
        ll x = bigmod(a, b/2, m);
        x = (x*x)%m;
        if(b%2==1) x = (x*a)%m;
        return x;
    }*/
    /*bool flag[mx5];
    veci prime;
    void sieve()
    {
        prime.pb(2);
        for(ll i=3; i*i<=100000; i+=2)
        {
            if(flag[i]) continue;
            for(ll j=i*i; j<=100000; j+=i+i) flag[j] = true;
        }
        for(int i=3; i<=100000; i+=2) if(!flag[i]) prime.pb(i);
    }*/

    ////=================START_FROM_HERE=====================////
    const int N = 101;
    int dis[N][N], h, w, vis[N][N];
    char a[N][N];
    int ok(int x, int y)
    {
        if(x>=0 and x<h and y>=0 and y<w) return 1;
        else return 0;
    }

    void bfs()
    {
        int mn = INT_MAX;
        deque<pii> q;
        pii pa;
        q.pb({0, 0});
        if(a[0][0]=='#') dis[0][0]=1;
        else dis[0][0]=0;
        while(!q.empty())
        {
            pa = q.front();
            q.pop_front();

            int x = pa.F;
            int y = pa.S;
            //cout << "x = " << x << " y = " << y << endl;
            //cout << "dis = " << dis[x][y] << endl;
            for(int k=0; k<2; k++)
            {
                int xx = x+fx[k];
                int yy = y+fy[k];

                int res = ok(xx, yy);
                if(res==1)
                {
                    int ti=0;
                    if(a[x][y]=='.' and a[xx][yy]=='#') ti = 1;
                    
                    if(dis[xx][yy]>dis[x][y]+ti)
                    {
                        dis[xx][yy] = dis[x][y]+ti;
                        ti==0 ? q.push_front({xx, yy}) : q.pb({xx, yy});
                    }
                }
            }
        }
        //debug(mn);
        //return mn;
    }
    int32_t main()
    {
        //Don't see test case until get 7/8 times wrong submission..!!
        //Try to make Corner, Even, Odd or Prime case..!!
        FastIO;
        cin >> h >> w;
        //memset(dis, 0, sizeof dis);
        for(int i=0; i<h; i++)
        {
            for(int j=0; j<w; j++)
            {
                cin >> a[i][j];
                dis[i][j] = INT_MAX;
            }
        }
        bfs();
        /*for(int i=0; i<h; i++)
        {
            for(int j=0; j<w; j++) cout << dis[i][j] << ' ';
            cout << endl;
        }*/
        cout << dis[h-1][w-1] << endl;
}


Measured memory_bytes: 3720