#include <bits/stdc++.h>
using namespace std;
int main() {
  int t[10][10], col[10], ln[10], i, j, k, m, n, rez = 0;
  string aux;
  j = 0;
  while (getline(cin, aux)) {
    for (i = 0; i < 8; i++) {
      if (aux[i] == 'W')
        t[j][i] = 0;
      else
        t[j][i] = 1;
    }
    j++;
  }
  for (i = 0; i < 8; i++) {
    ln[i] = 0;
    col[i] = 0;
  }
  for (i = 0; i < 8; i++) {
    k = 0;
    for (j = 0; j < 8; j++)
      if (t[j][i] == 0) k = 1;
    if (k == 0) ln[i] = 1;
  }
  for (i = 0; i < 8; i++) {
    k = 0;
    for (j = 0; j < 8; j++)
      if (t[i][j] == 0) k = 1;
    if (k == 0) col[i] = 1;
  }
  for (i = 0; i < 8; i++) {
    if (ln[i] == 1) rez++;
    if (col[i] == 1) rez++;
  }
  if (rez == 16)
    cout << 8;
  else
    cout << rez;
}
