/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-03-21 21:59:43
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

int dp[101][101];

constexpr int INF = 1e9;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int h, w; cin >> h >> w;
  vector<string> s(h); cin >> s;

  fill(dp[0], dp[101], INF);

  if (s[0][0] == '#') {
    dp[0][0] = 1;
  } else {
    dp[0][0] = 0;
  }

  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      int ph = i - 1, pw = j - 1;
      if (ph < 0 && pw < 0) {
        continue;
      } else if (ph < 0) {
        if (s[i][j] == '#' && s[i][pw] == '.') {
          dp[i][j] = dp[i][pw] + 1;
        } else {
          dp[i][j] = dp[i][pw];
        }
      } else if (pw < 0) {
        if (s[i][j] == '#' && s[ph][j] == '.') {
          dp[i][j] = dp[ph][j] + 1;
        } else {
          dp[i][j] = dp[ph][j];
        }
      } else {
        if (s[i][j] == '#' && s[ph][j] == '.' && s[i][pw] == '.') {
          dp[i][j] = min(dp[i][pw], dp[ph][j]) + 1;
        } else if (s[i][j] == '#' && s[i][pw] == '.') {
          dp[i][j] = min(dp[i][pw] + 1, dp[ph][j]);
        } else if (s[i][j] == '#' && s[ph][j] == '.') {
          dp[i][j] = min(dp[ph][j] + 1, dp[i][pw]);
        } else {
          dp[i][j] = min(dp[i][pw], dp[ph][j]);
        }
      }
    }
  }

  cout << dp[h - 1][w - 1] << endl;

  return 0;
}

Measured memory_bytes: 384