#include <bits/stdc++.h>   using namespace std;   const bool debug = false;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     string s[8];     for (int i = 0; i < 8; i++) {       cin >> s[i];     }     int r = 0, col = 0;     for (int i = 0; i < 8; i++) {       int c = 0;       for (int j = 0; j < 8; j++) {         if (s[i][j] ==  B ) c++;       }       if (c == 8) r++;     }     for (int i = 0; i < 8; i++) {       int c = 0;       for (int j = 0; j < 8; j++) {         if (s[j][i] ==  B ) c++;       }       if (c == 8) col++;     }     if (r == 0 and col == 0) {       cout << 0;       return 0;     }     if (r == 8 or col == 8) {       cout << 8;       return 0;     }     cout << r + col;   }   