#include #include using namespace std; using namespace atcoder; typedef long long ll; typedef long double dd; typedef pair l_l; typedef pair d_d; ll inf=(ll)1E18; #define rep(i,l,r) for(ll i=l;i<=r;i++) #define rrep(i,r,l) for(ll i=r;i>=l;i--) #define pb push_back ll max(ll a,ll b){if(ab)return b;else return a;} dd EPS=1E-10; #define fi first #define se second #define SORT(v) sort(v.begin(),v.end()) #define ERASE(v) sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end()) #define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin()) #define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin()) template inline bool chmax(T &a, S b) { if(a < b) { a = (T)b; return true; } return false; } template inline bool chmin(T &a, S b) { if(a > b) { a = (T)b; return true; } return false; } #define all(c) c.begin(),c.end() using mint = modint998244353; //using mint = modint1000000007; //using mint=modint; //using mint=static_modint<100>; //using mint=dd; //using mint=ll; typedef vector vl; typedef vector vvl; typedef vectorvvvl; typedef vectorvi; typedef vectorvvi; typedef vectorvvvi; typedef vectorvl_l; typedef vectorvvl_l; typedef vectorvs; typedef vectorvvs; typedef vector
vd; typedef vector vvd; typedef vectorvd_d; dd PI=acos((dd)-1); #define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout< using pq = priority_queue; template using pqg = priority_queue, greater>; // g++ -std=gnu++17 -Wall -Wextra -O2 -DONLINE_JUDGE main.cpp && ./a.out #define endl "\n" //インタラクティブで消す!!!!!!!!!!!!!!!!!!!!! #define popcount __builtin_popcountll #define SHUFFLE(v) shuffle(all(v),default_random_engine(chrono::system_clock::now().time_since_epoch().count())) ////////////////////////// template void DEBUG_PRINT(S x){ cerr< void DEBUG_PRINT(pairx){ cerr<<"("< void DEBUG_PRINT(vector x){ for(auto y:x)cerr< void DEBUG_PRINT(vector>x){ for(auto y:x)cerr<<"("< void DEBUG_PRINT(vector> x){ cerr<>n; n=2*n+1; vl a(n);rep(i,0,n-1)cin>>a[i]; if(n>=10){ cout<<0<1){ vl b; rep(i,0,(int)a.size()-3){ if(a[i]!=a[i+1] && a[i+1]!=a[i+2] && a[i]!=a[i+2]){ if((a[i+1]+3-a[i])%3==1){ b.pb(1); }else{ b.pb(2); } }else{ b.pb(0); } } a=b; for(auto x:a)cerr<