#include <bits/stdc++.h>
using namespace std;
int main() {
  int c = 0, a = 0, m = 0, v = 0, s = 0;
  char arr[8][8];
  int j = 0;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      cin >> arr[i][j];
    }
  }
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      if (arr[i][j] == 'B') a++;
      if (arr[j][i] == 'B') c++;
      s += (a / 8) + (c / 8);
    }
    a = 0;
    c = 0;
  }
  if (s == 16) s = 8;
  cout << s;
  return 0;
}
