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