#include <bits/stdc++.h>
using namespace std;
int main() {
  string arr[8];
  for (int i = 0; i < 8; i++) cin >> arr[i];
  char mat[8][8];
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++) mat[i][j] = arr[i][j];
  int count = 0;
  for (int i = 0; i < 8; i++) {
    bool blacked = true;
    for (int j = 0; j < 8; j++) {
      if (arr[j][i] == 'W') {
        blacked = false;
        break;
      }
    }
    if (blacked) count++;
  }
  if (count < 8) {
    for (int i = 0; i < 8; i++) {
      bool blacked = true;
      for (int j = 0; j < 8; j++) {
        if (arr[i][j] == 'W') {
          blacked = false;
          break;
        }
      }
      if (blacked) count++;
    }
  }
  cout << count;
  return 0;
}
