#include <bits/stdc++.h>
using namespace std;
int get_sum(int a, int s) {
  int ans = 0;
  while (a > 0) {
    ans += a % s;
    a /= s;
  }
  return ans;
}
int gcd(int a, int b) {
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
void ret(string s) {
  cout << s;
  exit(0);
}
int main() {
  string s[8];
  for (int i = 0; i < 8; i++) cin >> s[i];
  int kol = 0;
  for (int i = 0; i < 8; i++)
    if (s[i] == "BBBBBBBB") kol++;
  bool ok;
  for (int i = 0; i < 8; i++) {
    ok = true;
    for (int j = 0; j < 8; j++)
      if (s[j][i] == 'W') ok = false;
    if (ok) kol++;
  }
  if (kol == 16) kol = 8;
  cout << kol;
}
