#include <bits/stdc++.h>
using namespace std;
int main() {
  char B[8][8];
  int c = 0;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) cin >> B[i][j];
  }
  int ans = 16;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++)
      if (B[i][j] == 'W') {
        ans--;
        break;
      }
    for (int j = 0; j < 8; j++)
      if (B[j][i] == 'W') {
        ans--;
        break;
      }
  }
  if (ans == 16) ans = 8;
  cout << ans << endl;
  return 0;
}
