#include <bits/stdc++.h>
using namespace std;
int n,m;
char a[6][6];
int ans=0;

void dfs(int x,int y)
{
    if(a[x][y]=='*') ans++;

    if(x==n-1 && y==m-1){
        cout<<ans<<"\n";
        exit(0);
        
    }
    /// '*'
    if(x<n && y+1<m && a[x][y+1]=='*') dfs(x,y+1);/// right
    if(x+1<n && y<m && a[x+1][y]=='*') dfs(x+1,y);/// down

    /// '.'
    if(x<n && y+1<m && a[x][y+1]=='.') dfs(x,y+1);
    if(x+1<n && y<m && a[x+1][y]=='.') dfs(x+1,y);
}

int main()
{
    cin>>n>>m;
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            cin>>a[i][j];

    dfs(0,0);
}
