#include <bits/stdc++.h>
int i, j, k, m, n;
char s[10][10];
int main() {
  k = 0;
  for (i = 0; i < 8; i++) scanf("%s", s[i]);
  for (i = 0; i < 8; i++) {
    m = 0;
    for (j = 0; j < 8; j++)
      if (s[i][j] == 'W') m = 1;
    if (m == 0) k++;
  }
  for (i = 0; i < 8; i++) {
    m = 0;
    for (j = 0; j < 8; j++)
      if (s[j][i] == 'W') m = 1;
    if (m == 0) k++;
  }
  if (k == 16) k = 8;
  printf("%d\n", k);
  return 0;
}
