#include <bits/stdc++.h>
using namespace std;
int main() {
  string g[8];
  for (int i = 0; i < 8; i++) cin >> g[i];
  int c = 0, r = 0;
  for (int i = 0; i < 8; i++) {
    bool f1 = true, f2 = true;
    for (int j = 0; j < 8; j++) {
      if (g[i][j] == 'W') f1 = false;
      if (g[j][i] == 'W') f2 = false;
    }
    if (f1) c++;
    if (f2) r++;
  }
  if (c == 8 && r == 8)
    cout << 8 << endl;
  else
    cout << c + r << endl;
}
