#include using namespace std; typedef long long int ll; typedef long double ld; typedef pair ii; typedef vector vi; typedef vector vii; #define PB push_back #define FOR(prom,a,b) for( ll prom = (a); prom < (ll)(b); ++prom ) #define F(a) FOR(i,0,a) #define FF(a) FOR(j,0,a) #define EPS (1e-10) #define INF ((1LL<<62LL)-1LL) #define EQ(a,b) (fabs(a-b)/fabs(a+b) < EPS) ll M,N; ll solve(vii &a){ set s; ll r=INF,right=M; F(a.size()){ ll j=a[i].first; if(a[i].second > right)continue; s.insert({a[i].second,a[i].first}); if(i!=a.size()-1 && a[i].first==a[i+1].first)continue; while(s.size()>N/2){ auto it=s.end();--it; right=it->first-1; while(s.size()>0 && it->first > right){ s.erase(it); if(s.size()==0)break; it=s.end();--it; } } // for ( auto x : s ) { // cerr << "[" << x.first <<' '<second<<' '<second!=j)continue; // cout<<" set:"<<((i+1) * (s.rbegin()->first+1))<first+1)); // cout<>M>>N){ vii a[4]; F(N){ ll x,y;cin>>x>>y; a[0].PB({y,x}); a[1].PB({M-1-y,x}); a[2].PB({y,M-1-x}); a[3].PB({M-1-y,M-1-x}); } F(4)sort(a[i].begin(),a[i].end()); if(N%2){ cout<<-1<