#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int main() {
  bool all = 1;
  bool vert[8], hor[8];
  for (long long i = 0; i < (int)8; i++) {
    vert[i] = 1;
    hor[i] = 1;
  }
  for (long long i = 0; i < (int)8; i++)
    for (long long j = 0; j < (int)8; j++) {
      char a;
      cin >> a;
      if (a == 'W') {
        vert[i] = 0;
        hor[j] = 0;
        all = 0;
      }
    }
  if (all) {
    cout << 8;
    return 0;
  }
  int ans = 0;
  for (long long i = 0; i < (int)8; i++) {
    if (vert[i]) ans++;
    if (hor[i]) ans++;
  }
  cout << ans;
  return 0;
}
