#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
const long long EPS = 1e-9;
const long double PI = acos(-1.0);
const int MAXX = 2e5 + 3;
const int LOGMAXN = 30;
using namespace std;
char grid[9][9];
int main() {
  for (int i = 0; i < 8; ++i) {
    scanf("%s", grid[i]);
  }
  bool need = true;
  for (int i = 0; i < 8; ++i)
    for (int j = 0; j < 8; ++j)
      if (grid[i][j] == 'W') need = false;
  if (need) return printf("%d\n", 8), 0;
  int ans = 0;
  for (int i = 0; i < 8; ++i) {
    need = true;
    for (int j = 0; j < 8; ++j)
      if (grid[i][j] == 'W') need = false;
    if (need) ++ans;
    need = true;
    for (int j = 0; j < 8; ++j)
      if (grid[j][i] == 'W') need = false;
    if (need) ++ans;
  }
  printf("%d\n", ans);
  return 0;
}
