#include <bits/stdc++.h>
using namespace std;
int main() {
  char A[9][9];
  int kt = 0, ans = 0, kt2 = 0;
  for (long long i = 1; i <= 8; i++) {
    for (long long j = 1; j <= 8; j++) {
      cin >> A[i][j];
      if (A[i][j] != 'W') kt = -1;
      if (A[i][j] != 'B') kt2 = -1;
    }
  }
  if (kt2 == 0) {
    cout << "8";
    return 0;
  }
  if (kt == 0)
    cout << "0";
  else if (kt == -1) {
    for (long long i = 1; i <= 8; i++) {
      bool full = true;
      for (long long j = 1; j <= 8; j++) {
        if (A[i][j] == 'W') full = false;
      }
      ans += full;
      full = true;
      for (long long j = 1; j <= 8; j++) {
        if (A[j][i] == 'W') full = false;
      }
      ans += full;
    }
    cout << ans << endl;
  }
}
