#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n = 8;
  bool ww = 1;
  int con = 0;
  while (n--) {
    string s;
    cin >> s;
    bool tb = 1;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == 'W') {
        tb = 0;
      }
    }
    if (tb == 0 && ww == 1) {
      for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'B') {
          con++;
        }
      }
      ww = 0;
    } else if (tb) {
      con++;
    }
  }
  cout << con;
  return 0;
}
