#include "bits/stdc++.h"
using namespace std;

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()         

#define bug(...)                                  __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn 
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

inline void INP();
const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q, m;
int arr[N+2];
int dp[101][101];
char mat[101][101];


bool safe(int x,int y)
{
   if( x < 0 or y < 0 or x >= n or y >= m ) return 0;
   return 1;
}

bool vis[101][101];
void trav(int x, int y, vector<pii> &vec)
{           
      if(vis[x][y]) return;
      
      vis[x][y] = 1;
      vec.pb({x,y});

      if(safe(x+1, y) and mat[x+1][y] == '#' ) trav(x+1,y,vec);
      if(safe(x, y+1) and mat[x][y+1] == '#' ) trav(x,y+1,vec);
}


int get(int i, int j)
{
      if( i == n-1 and j == m -1 )
      {
            if( mat[i][j] == '.' ) return 0;
            else return 1;
      }

      int &mafia = dp[i][j];
      if(mafia != -1) return mafia;
      int a1 = INF , b1 = INF;

      if( mat[i][j] == '.' )
      {
            if( safe(i+1, j) ) a1 =  get(i+1, j );
            if( safe(i,j+1) )  b1 =  get(i, j+1);
      }
      else
      {     
            vector<pii> vec;
            memset(vis, false, sizeof vis);
            trav(i,j,vec);

            for(auto x: vec)
            {
                  if(x.ff == n-1 and x.ss == m-1) a1 = min(a1, 1LL);
                  if( safe(x.ff+1, x.ss) ) a1 = min(a1, 1 + get(x.ff+1, x.ss));
                  if( safe(x.ff, x.ss+1) ) a1 = min(a1, 1 + get(x.ff, x.ss+1));
            }
      }

      return mafia = min(a1,b1);
}
void solve()
{
      cin >> n >> m;
      lop(i,0,n)lop(j,0,m) cin >> mat[i][j];
      memset(dp, -1, sizeof dp);

      cout << get(0,0) << endl;
      
}


int32_t main()
{
      
      ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);

      int t = 1;
      //cin >> t;
      while(t--) solve();

}











inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}


// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //






Measured memory_bytes: 10728