#include <bits/stdc++.h>   using namespace std;   char c[10][10];   int ans;   int main() {     cin >> c[1] >> c[2] >> c[3] >> c[4] >> c[5] >> c[6] >> c[7] >> c[8];     for (int i = 1; i <= 8; i++) {       int p = 0;       for (int j = 0; j < 8; j++)         if (c[i][j] ==  B ) p++;       if (p == 8) ans++;       p = 0;       for (int j = 1; j <= 8; j++)         if (c[j][i - 1] ==  B ) p++;       if (p == 8) ans++;     }     if (ans != 16)       cout << ans;     else       cout << 8;     return 0;   }   