#include <bits/stdc++.h>
using namespace std;
char chess[10][15];
int res = 0;
int main() {
  for (int i = 1; i <= 8; i++) {
    scanf("%s", &chess[i][1]);
    bool B = 1;
    for (int j = 1; j <= 8; j++)
      if (chess[i][j] == 'W') B = 0;
    res += B;
  }
  if (res == 8) {
    puts("8");
    return 0;
  }
  for (int i = 1; i <= 8; i++) {
    bool B = 1;
    for (int j = 1; j <= 8; j++)
      if (chess[j][i] == 'W') B = 0;
    res += B;
  }
  printf("%d", res);
  return 0;
}
