#include <bits/stdc++.h>
using namespace std;
int main() {
  char board[8][8];
  int wRow = -1, wCol = -1;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      cin >> board[i][j];
      if (board[i][j] == 'W') {
        wRow = i;
        wCol = j;
      }
    }
  }
  if (wRow == -1) {
    cout << 8 << endl;
  } else {
    int c = 0;
    for (int i = 0; i < 8; i++) {
      if (board[wRow][i] == 'B') {
        c++;
      }
      if (board[i][wCol] == 'B') {
        c++;
      }
    }
    cout << c << endl;
  }
  return 0;
}
