#include <bits/stdc++.h>
using namespace std;
const int N = 2001;
char s[N];
int main() {
  int q, w, e, r, t;
  cin >> q >> w;
  for (e = 0; e < q; e++) {
    scanf("%s", s);
  }
  q = w;
  int res = 0;
  char c = '.';
  for (w = 0; w < q; w++) {
    if ((c != s[w]) && (c == '.')) {
      res++;
    }
    c = s[w];
  }
  cout << res;
  return 0;
}
