#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //eolibraries #define lnf 3999999999999999999 #define inf 999999999 #define fi first #define se second #define pb push_back #define ll long long #define ld long double #define all(c) (c).begin(),(c).end() #define sz(c) (ll)(c).size() #define make_unique(a) sort(all(a)),a.erase(unique(all(a)),a.end()) #define pii pair #define rep(i,n) for(ll i = 0 ; i < n ; i++) #define drep(i,n) for(ll i = n-1 ; i >= 0 ; i--) #define crep(i,x,n) for(ll i = x ; i < n ; i++) #define vi vector #define vec(...) vector<__VA_ARGS__> #define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); //eodefine using namespace std; const ll mxn=500000; int main(){ fcin; ll n; cin>>n; vi a(n); rep(i,n) cin>>a[i]; ll e=0,w=0; rep(i,n){ if(a[i]==1) e++; else if(a[i]==0) w++; } vec(pii) nea; for(ll i=0;i