/*
    _________             ____    __   __    __      __       __       __   __  
   |___   ___|           /  __)  |  | |  |  |  \    /  |     /  \     |  \ |  | 
       | |     __       (  {__   |  | |  |  |   \  /   |    / /\ \    |   \|  | 
       | |    /__\       \__  \  |  |_|  |  |    \/    |   / ____ \   |       | 
       | |                __)  ) {       }  |  |\__/|  |  / /    \ \  |  |\   | 
       |_|               (____/   \_____/   |__|    |__| /_/      \_\ |__| \__| 
*/
#include<bits/stdc++.h>
#define t_suman ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long int
#define pll pair<ll,ll>
#define VP vector< pll >
#define VLL vector< ll >
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int (i) = (a); (i) < (b); (i)++)
#define rrep(i,a,b) for(int (i) = (a); (i) > (b); (i)--)
#define all(v) (v).begin(),(v).end()
#define FF first
#define SS second
#define in insert
#define out erase
#define MOD 1000000007
#define MAX 1000005
using namespace std;


ll gcd(ll a, ll b){ 
    if (a == 0) return b; 
    return gcd(b % a, a); 
}
ll power(ll x, unsigned ll y){ 
    int res = 1; 
   
    while(y>0){  
        if (y & 1) res = res*x; 
   
        y = y>>1;
        x = x*x;
    } 
    return res; 
}
ll digSum(ll n){
	return n==0 ? 0 : (n%10)+digSum(n/10);
}
ll digMul(ll n){
	return n==0 ? 0 : (n%10)*digSum(n/10);
}
ll countNumberOfDigs(ll n){
	if(n==0)return 1;
	ll count=0;
	while(n!=0){
		n/=10;
		count++;
	}
	return count;
}
bool isPrime(ll n){ 
    if (n <= 1) return false; 
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false; 
  
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
}

struct pack
{
	ll d,t,s;
	pack(ll d,ll t,ll s):d(d),t(t),s(s){}
};
struct compare { 
    bool operator()(const pack& a , const pack& b){
		return a.s>b.s;   
	} 
};
bool cmp(const pack& a , const pack& b){
    return a.d<b.d;
}
std::vector<ll> merge(std::vector<ll> &v,std::vector<ll> vN, ll k3){
	std::vector<ll> res;
	ll i=0,j=0;
	while(i<v.size()&&j<vN.size()){
		if(v[i]>=vN[j]){
			res.pb(v[i++]);
		}
		else{
			res.pb(vN[j++]);
		}
		if(res.size()==k3)return res;
	}
	while(i<v.size()){
		res.pb(v[i++]);
		if(res.size()==k3)return res;
	}
	while(j<vN.size()){
		res.pb(vN[j++]);
		if(res.size()==k3)return res;
	}
	return res;
}
/*void dfs(map<ll,vector<ll>>& tree,map<ll,ll>& parent,map<ll,bool>& b1,ll pre){
	rep(i,0,tree[pre].size()){
		if(b1.find(tree[pre][i])==b1.end()){
			b1[tree[pre][i]]=1;
			parent[tree[pre][i]]=pre;
			dfs(tree,parent,b1,tree[pre][i]);
		}
	}
}*/
/*void fun(map<ll,vector<ll>>& tree,ll pre,vector<ll>& perf,vector<bool>& avl,map<ll,bool>& b1){
	rep(i,0,tree[pre].size()){
		if(b1.find(tree[pre][i])==b1.end()){
			b1[tree[pre][i]]=1;
			avl[tree[pre][i]]=0;
			perf.pb(tree[pre][i]);
			fun(tree,tree[pre][i],perf,avl,b1);
		}
	}
}
void dfs(map<ll,VLL>& tree,map<ll,VLL>& list,ll pre,map<ll,bool>& b1,VLL& color){
	list[color[pre]].pb()
	VLL ar=tree[pre];
	rep(i,0,ar.size()){
		if(b1.find(ar[i])==b1.end()){
			b1[ar[i]]=0;
			dfs(tree,list,ar[i],b1,color);
		}
	}
}*/
ll fun(vector<string>& g,vector<vector<ll>>& arr,ll u,ll v,char ch){
	if(u>=g.size()||v>=g[0].length())return INT_MAX;
	
	if(u==g.size()-1&&v==g[0].length()-1)
		arr[u][v]=g[u][v]=='.'?0:1;
	if(arr[u][v]!=-1){
		if(g[u][v]==ch&&ch=='#')
			return arr[u][v]-1;
		else return arr[u][v];
	}
	if(g[u][v]=='#'){
		arr[u][v]=1;
	}
	else arr[u][v]=0;
	arr[u][v]+=min(fun(g,arr,u+1,v,g[u][v]),fun(g,arr,u,v+1,g[u][v]));
	if(g[u][v]==ch&&ch=='#')
		return arr[u][v]-1;
	return arr[u][v];
}

int main(void){
	t_suman;
	
	ll n,m;
	cin>>n>>m;
	vector<string> g(n);
	rep(i,0,n)cin>>g[i];
	/*ll count=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(g[i][j]=='.')count++;
		}
	}
	if()*/
	vector<vector<ll>> arr(n,vector<ll>(m,-1));
	ll res=fun(g,arr,0,0,'*');
	/*if(res%2==0)cout<<res;
	else cout<<2*res;*/
	/*for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cout<<arr[i][j]<<" ";
		}cout<<"\n";
	}*/
	cout<<res;
	return 0;
}

Measured memory_bytes: 384