#include <bits/stdc++.h>
char mat[8][8];
int main() {
  int resp = 0;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      scanf(" %c", &mat[i][j]);
    }
  }
  for (int i = 0; i < 8; i++) {
    int ok = 1;
    int ok2 = 1;
    for (int j = 0; j < 8; j++) {
      if (mat[i][j] == 'W') ok = 0;
      if (mat[j][i] == 'W') ok2 = 0;
    }
    resp += ok + ok2;
  }
  if (resp == 16)
    printf("8\n");
  else
    printf("%d", resp);
}
