#include <bits/stdc++.h>
char c[8][9];
int main() {
  int i, j, a, m = 0;
  for (i = 0; i < 8; i++)
    for (j = 0; j < 9; j++) scanf("%c", &c[i][j]);
  for (i = 0; i < 8; i++) {
    a = 0;
    for (j = 0; j < 8; j++) {
      if (c[i][j] == 'W') break;
      a++;
      if (a == 8) m++;
    }
  }
  if (m == 8) {
    printf("8");
    return 0;
  }
  for (j = 0; j < 8; j++) {
    a = 0;
    for (i = 0; i < 8; i++) {
      if (c[i][j] == 'W') break;
      a++;
      if (a == 8) m++;
    }
  }
  printf("%d", m);
  return 0;
}
