#include <bits/stdc++.h>
using namespace std;
void solve() {
  char a[8][8];
  int i, j, c = 0, k, d = 0, e = 1, f = 0;
  vector<int> v;
  for (i = 0; i < 8; i++) {
    for (j = 0; j < 8; j++) {
      cin >> a[i][j];
    }
  }
  for (i = 0; i < 8; i++) {
    d = 0;
    for (j = 0; j < 8; j++) {
      if (a[i][j] == 'W') {
        d++;
      }
    }
    if (d == 0) {
      c++;
    } else if (d < 8 && d >= 1 && e == 1) {
      for (j = 0; j < 8; j++) {
        if (a[i][j] == 'B') {
          v.push_back(j);
          c++;
        }
      }
      e++;
    } else if (e > 1) {
      for (j = 0; j < 8; j++) {
        if (a[i][j] == 'B') {
          for (k = 0; k < v.size(); k++) {
            if (v[k] == j) {
              f = 1;
              break;
            }
          }
          if (f == 0) {
            v.push_back(j);
            c++;
          } else
            f = 0;
        }
      }
    }
  }
  cout << c << endl;
  return;
}
int main() { solve(); }
