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