#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
inline int readInt() {
  int x;
  scanf("%d", &x);
  return x;
}
const double EPS = 1E-8;
const int INF = 100000000;
struct Edge {
  int to, from;
  long long cost;
  Edge(int from, int to, long long cost) : from(from), to(to), cost(cost) {}
};
class UnionFind {
 public:
  vector<long long> par;
  vector<long long> siz;
  UnionFind(long long sz_) : par(sz_), siz(sz_, 1LL) {
    for (long long i = 0; i < sz_; ++i) par[i] = i;
  }
  void init(long long sz_) {
    par.resize(sz_);
    siz.assign(sz_, 1LL);
    for (long long i = 0; i < sz_; ++i) par[i] = i;
  }
  long long root(long long x) {
    while (par[x] != x) {
      x = par[x] = par[par[x]];
    }
    return x;
  }
  bool merge(long long x, long long y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
    return true;
  }
  bool issame(long long x, long long y) { return root(x) == root(y); }
  long long size(long long x) { return siz[root(x)]; }
};
vector<vector<Edge>> graph;
long long mod_pow(long long x, long long n, long long mod) {
  long long res = 1;
  bool c = false;
  while (n) {
    if (n & 1) res = res * x;
    if (res > mod) {
      c = true;
      res %= mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  if (c) return mod;
  return res;
}
bool sieve[5000000 + 10];
void make_sieve() {
  for (int i = 0; i < 5000000 + 10; ++i) sieve[i] = true;
  sieve[0] = sieve[1] = false;
  for (int i = 2; i * i < 5000000 + 10; ++i)
    if (sieve[i])
      for (int j = 2; i * j < 5000000 + 10; ++j) sieve[i * j] = false;
}
bool isprime(long long n) {
  if (n == 0 || n == 1) return false;
  for (long long i = 2; i * i <= n; ++i)
    if (n % i == 0) return false;
  return true;
}
template <typename T>
vector<T> gauss_jordan(const vector<vector<T>>& A, const vector<T>& b) {
  int n = A.size();
  vector<vector<T>> B(n, vector<T>(n + 1));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      B[i][j] = A[i][j];
    }
  }
  for (int i = 0; i < n; ++i) B[i][n] = b[i];
  for (int i = 0; i < n; ++i) {
    int pivot = i;
    for (int j = i; j < n; ++j) {
      if (abs(B[j][i]) > abs(B[pivot][i])) pivot = j;
    }
    swap(B[i], B[pivot]);
    if (abs(B[i][i]) < EPS) return vector<T>();
    for (int j = i + 1; j <= n; ++j) B[i][j] /= B[i][i];
    for (int j = 0; j < n; ++j) {
      if (i != j) {
        for (int k = i + 1; k <= n; ++k) B[j][k] -= B[i][j] * B[i][k];
      }
    }
  }
  vector<T> x(n);
  for (int i = 0; i < n; ++i) x[i] = B[i][n];
  return x;
}
long long GCD(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return GCD(b, a % b);
}
vector<vector<long long>> mul(vector<vector<long long>>& A,
                              vector<vector<long long>>& B) {
  vector<vector<long long>> C(A.size(), vector<long long>((int)B[0].size()));
  for (int i = 0; i < A.size(); ++i) {
    for (int k = 0; k < B.size(); ++k) {
      for (int j = 0; j < B[0].size(); ++j) {
        C[i][j] = (C[i][j] + A[i][k] * B[k][j] % 1000000007) % 1000000007;
      }
    }
  }
  return C;
}
vector<vector<long long>> mat_pow(vector<vector<long long>> A, long long n) {
  vector<vector<long long>> B(A.size(), vector<long long>((int)A.size()));
  for (int i = 0; i < A.size(); ++i) {
    B[i][i] = 1;
  }
  while (n > 0) {
    if (n & 1) B = mul(B, A);
    A = mul(A, A);
    n >>= 1;
  }
  return B;
}
bool operator<(const pair<int, int>& a, const pair<int, int>& b) {
  if (a.first == b.first) return a.second < b.second;
  return a.first < b.first;
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % 1000000007;
    inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
    finv[i] = finv[i - 1] * inv[i] % 1000000007;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % 1000000007) % 1000000007;
}
int bit[1000010];
int sum(int i) {
  int s = 0;
  while (i > 0) {
    s += bit[i];
    i -= i & -i;
  }
  return s;
}
void add(int i, int x) {
  while (i <= 1000010) {
    bit[i] += x;
    i += i & -i;
  }
}
long long extGCD(long long a, long long b, long long& x, long long& y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long d = extGCD(b, a % b, y, x);
  y -= a / b * x;
  return d;
}
vector<vector<pair<int, int>>> G(110);
int ans[110];
void dfs(int v, int c) {
  if (G[v].size() == 0) {
    ans[v] += c;
    return;
  }
  for (auto e : G[v]) {
    int u = e.first;
    int need = e.second;
    dfs(u, c * need);
  }
}
vector<string> v;
bool used[8][8];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  for (int i = 0; i < (int)8; ++i) {
    string str;
    cin >> str;
    v.push_back(str);
  }
  for (int i = 0; i < (int)8; ++i)
    for (int j = 0; j < (int)8; ++j) used[i][j] = false;
  int cnt = 0;
  for (int i = 0; i < 8; i++) {
    bool c = true;
    for (int j = 0; j < 8; j++) {
      if (v[i][j] == 'W') c = false;
    }
    if (c) {
      cnt++;
      for (int j = 0; j < 8; j++) {
        used[i][j] = true;
      }
    }
  }
  for (int i = 0; i < 8; i++) {
    bool c = true;
    for (int j = 0; j < 8; j++) {
      if (v[j][i] == 'W') c = false;
    }
    bool j2 = true;
    for (int j = 0; j < 8; j++) {
      j2 &= used[j][i];
    }
    if (c && !j2) cnt++;
  }
  cout << cnt << endl;
  return 0;
}
