#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
char a[9][9];
long long ans = 0;
int main() {
  for (long long i = 1; i <= (long long)(8); i++)
    for (long long j = 1; j <= (long long)(8); j++) cin >> a[i][j];
  for (long long i = 1; i <= (long long)(8); i++) {
    long long p = 1;
    for (long long j = 1; j <= (long long)(8); j++) {
      if (a[i][j] == 'W') p = 0;
    }
    ans += p;
  }
  for (long long i = 1; i <= (long long)(8); i++) {
    long long p = 1;
    for (long long j = 1; j <= (long long)(8); j++) {
      if (a[j][i] == 'W') p = 0;
    }
    ans += p;
  }
  if (ans == 16) ans = 8;
  printf("%d", ans);
  fclose(stdin);
  fclose(stdout);
}
