#include <bits/stdc++.h>

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
int main() {
	int h = ri();
	int w = ri();
	std::string s[h];
	for (auto &i : s) std::cin >> i;
	int dp[h][w];
	for (auto &i : dp) for (auto &j : i) j = 1000000000;
	dp[0][0] = s[0][0] == '#';
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (i + 1 < h) dp[i + 1][j] = std::min(dp[i + 1][j], dp[i][j] + (s[i][j] == '.' && s[i + 1][j] == '#'));
			if (j + 1 < w) dp[i][j + 1] = std::min(dp[i][j + 1], dp[i][j] + (s[i][j] == '.' && s[i][j + 1] == '#'));
		}
	}
	printf("%d\n", dp[h - 1][w - 1]);
	return 0;
}


