#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

int dx[2] = {1, 0};
int dy[2] = {0, 1};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w; cin >> h >> w;
	vector<string> v(h);
	for(auto &i:v) cin >> i;
	vector<vector<int>> a(h, vector<int>(w, 1e9));
	a[h-1][w-1] = (v[h-1][w-1] == '#');
	for(int i=h-1; i>=0; --i)
		for(int j=w-1; j>=0; --j)
			for(int k=0; k<2; ++k){
				int nx = i+dx[k];
				int ny = j+dy[k];
				if(nx >= h || ny >= w) continue;
				int t = (v[i][j] == '#' && v[nx][ny] == '.');
				a[i][j] = min(a[i][j], a[nx][ny]+t);
			}
	cout << a[0][0] << "\n";
}