#include #include #include #include using namespace std; #define REP(i,first,last) for (int i=first;i win_count){ int win_0 = win_count[0]; int rank = 1; sort(win_count.begin()+1, win_count.end()); REP(i,1,6){ if (win_count[i] > win_0 && win_count[i-1] != win_count[i]) { rank++; } } answer = (rank < answer) ? rank : answer; } void solve(int x, int y, vector win_count){ if (x >= N) { y++; if (y >= N) { return calc(win_count); } x = y; } if (game_results[y][x] == 'o') { win_count[y]++; solve(x+1, y, win_count); } else if (game_results[y][x] == 'x') { win_count[x]++; solve(x+1, y, win_count); } else { win_count[y]++; solve(x+1, y, win_count); win_count[y]--; win_count[x]++; solve(x+1, y, win_count); } } int main(){ cin >> N; char val; REP(i,0,6){ scanf("%s", game_results[i]); } vector win_count(6,0); solve(0,0,win_count); cout<