#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz=105;

int n,m;
char s[sz][sz];
int dp[sz][sz][2];

int fnc(int x, int y, int f)
{
    if(dp[x][y][f]!=-1) return dp[x][y][f];

    int h = s[x][y]=='#', nf;
    if(h && f) h = 0, nf = 1;
    else if(h && !f) h = 1, nf = 1;
    else h = 0, nf = 0;

    if(x==n-1 && y==m-1) return h;

    int now = sz;
    if(x<n-1) now = min(now, fnc(x+1, y, nf));
    if(y<m-1) now = min(now, fnc(x, y+1, nf));
    return dp[x][y][f] = h + now;
}

int main()
{
    cin >> n >> m;
    for(int i=0; i<n; i++) scanf("%s", s[i]);
    memset(dp, -1, sizeof(dp));
    cout << fnc(0,0,0) << endl;
}
