#include <bits/stdc++.h>
int main() {
  int n, i, j, row = 0, coloum = 0;
  char wb[8][8];
  for (i = 0; i < 8; i++)
    for (j = 0; j < 8; j++) scanf(" %c", &wb[i][j]);
  for (i = 0; i < 8; i++) {
    for (j = 0; j < 8; j++) {
      if (wb[i][j] == 'W') {
        break;
      }
    }
    if (j == 8) row++;
    for (j = 0; j < 8; j++) {
      if (wb[j][i] == 'W') {
        break;
      }
    }
    if (j == 8) coloum++;
  }
  if (coloum == 8 || row == 8) {
    printf("8\n");
  } else {
    printf("%d\n", row + coloum);
  }
  return 0;
}
