#include <bits/stdc++.h>
using namespace std;
int main() {
  string chessboard[9];
  int count = 0;
  for (int i = 0; i < 8; i++) {
    cin >> chessboard[i];
  }
  for (int i = 0; i <= 7; i++) {
    int check = 1;
    for (int j = 0; j <= 7; j++) {
      if (chessboard[i][j] == 'W') {
        check = 0;
        break;
      }
    }
    if (check == 1) {
      count++;
    }
  }
  if (count == 8) {
    cout << "8";
  } else {
    for (int i = 0; i <= 7; i++) {
      int check = 1;
      for (int j = 0; j <= 7; j++) {
        if (chessboard[j][i] == 'W') {
          check = 0;
          break;
        }
      }
      if (check == 1) {
        count++;
      }
    }
    cout << count;
  }
  return 0;
}
