#include <bits/stdc++.h>
using namespace std;
int main() {
  char map[10][10];
  int c = 0, r = 0;
  for (int i = 0; i < 8; ++i) scanf("%s", map[i]);
  for (int i = 0; i < 8; ++i) {
    bool ok1 = true;
    bool ok2 = true;
    for (int j = 0; j < 8; ++j)
      if (map[i][j] == 'W') {
        ok1 = false;
        break;
      }
    for (int j = 0; j < 8; ++j)
      if (map[j][i] == 'W') {
        ok2 = false;
        break;
      }
    if (ok1) r++;
    if (ok2) c++;
  }
  if (r == 8 && c == 8)
    cout << 8 << endl;
  else
    cout << (r + c) << endl;
  return 0;
}
