#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define sz size() #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rep(i,a,b) for(int i=(a);i<(b);++i) #define clr(a, b) memset((a), (b) ,sizeof(a)) #define MOD 1000000007 int n; vector v; int grundy[1<<20]; int isKadomatsu(int a, int b, int c){ if((ac)||(a>b&&ab)||(c>a&&c se; rep(a,0,n){ rep(b,a+1,n){ rep(c,b+1,n){ if((d&(1<>n; rep(i,0,n){ int a; cin>>a; v.pb(a); } clr(grundy,-1); rep(a,0,n){ rep(b,a+1,n){ rep(c,b+1,n){ if(1==isKadomatsu(v[a],v[b],v[c])){ int d = 0; d |= 1<