#include <bits/stdc++.h>
using namespace std;
int n, m, c, ans;
char a[101][101];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  for (int j = 1; j <= m; j++)
    if (a[n][j] == '.')
      ans += c, c = 0;
    else
      c = 1;
  ans += c;
  cout << ans << endl;
  return 0;
}
