#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<string> a(8);
  for (int i = 0; i < 8; ++i) {
    cin >> a[i];
  }
  int ans = 0;
  for (int i = 0; i < 8; ++i) {
    pair<bool, bool> flag = {true, true};
    for (int j = 0; j < 8; ++j) {
      if (a[i][j] == 'W') {
        flag.first = false;
      }
      if (a[j][i] == 'W') {
        flag.second = false;
      }
    }
    ans += flag.first + flag.second;
  }
  cout << (ans == 16 ? 8 : ans) << '\n';
  return 0;
}
