#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
clock_t time_p = clock();
void rtime() {
  time_p = clock() - time_p;
  cout << "\nTime Taken : " << fixed << (float)(time_p) / CLOCKS_PER_SEC
       << "s\n";
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a / gcd(a, b) * b); }
long long expo(long long x, long long y) {
  long long res = 1;
  x = x % 1000000007;
  while (y > 0) {
    if (y & 1) res = (1ll * res * x) % 1000000007;
    y = y >> 1;
    x = (1ll * x * x) % 1000000007;
  }
  return res % 1000000007;
}
long long inv_mod(long long q, long long m = 1000000007) {
  return (expo(q, m - 2) % m);
}
long long ncr(long long n, long long r) {
  long long res = 1;
  if (r > n - r) r = n - r;
  for (long long i = 0; i < r; i++) {
    res *= n - i;
    res /= i + 1;
  }
  return res;
}
long long max(long long a, long long b) { return (a > b) ? a : b; }
bool prime(long long n) {
  long long i;
  for (i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) return false;
  }
  return true;
}
bool comp(const pair<long long, long long> &a,
          const pair<long long, long long> &b) {
  if (a.second - a.first == b.second - b.first) {
    return (a.first < b.first);
  }
  return (a.second - a.first > b.second - b.first);
}
long long rr[] = {0, 1, 1, 1, 0, -1, -1, -1};
long long cc[] = {1, 1, 0, -1, -1, -1, 0, 1};
long long n, m, k, x, a[5 * 100000 + 10], b[5 * 100000 + 10];
void solve() {
  string s[8];
  for (long long i = 0; i < (long long)8; i++) cin >> s[i];
  long long r = 0, c = 0, n = 8;
  for (long long i = 0; i < n; i++) {
    long long flg = 1;
    for (long long j = 0; j < 8; j++) {
      if (s[i][j] == 'W') {
        flg = 0;
        break;
      }
    }
    if (flg) r++;
  }
  for (long long i = 0; i < n; i++) {
    long long flg = 1;
    for (long long j = 0; j < 8; j++) {
      if (s[j][i] == 'W') {
        flg = 0;
        break;
      }
    }
    if (flg) c++;
  }
  if (c == 8) c -= 8;
  cout << c + r;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
}
