#include <bits/stdc++.h>
int main() {
  char matrix[8][8];
  int result = 16;
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++) {
      std::cin >> matrix[i][j];
    }
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++) {
      if (matrix[i][j] == 'W') {
        result--;
        break;
      }
    }
  for (int j = 0; j < 8; j++)
    for (int i = 0; i < 8; i++) {
      if (matrix[i][j] == 'W') {
        result--;
        break;
      }
    }
  (result == 16) ? std::cout << 8 : std::cout << result;
  return 0;
}
