#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
template <class _T>
inline string tostr(const _T& a) {
  ostringstream os("");
  os << a;
  return os.str();
}
const long double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-9;
void ASS(bool b) {
  if (!b) {
    ++*(int*)0;
  }
}
int x[12], y[12];
char a[12][12];
int main() {
  cout.flags(ios::fixed);
  cout.precision(2);
  bool all = true;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      cin >> a[i][j];
      if (a[i][j] == 'W') {
        all = false;
      }
    }
  }
  if (all) {
    cout << 8;
    return 0;
  }
  int ans = 16;
  memset(x, 0, sizeof(x));
  memset(y, 0, sizeof(y));
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++) {
      if (a[i][j] == 'W') {
        x[i] = 1;
        y[j] = 1;
      }
    }
  for (int i = 0; i < 8; i++) ans -= x[i] + y[i];
  cout << ans;
  return 0;
}
