#include //#pragma GCC optimize("O3") //#define int long long using namespace std; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair pii; typedef vector vi; signed main(){ cin.tie(0); ios::sync_with_stdio(0); int n; cin >> n; vector f(n); for(auto &t : f) cin >> t; vector given(n); // 0: none, 1: only F, 2: only S, 3: both vector adjF(n), adjS(n); for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(f[i][j] == 'F'){ adjF[i] |= (1< (3*n+7)/8 || (n-num) > (3*n+3)/4+1) continue; int have = 0; for(int j = 0; j < n; j++) if(i&(1<