#include using namespace std; int f(int a){ if(a%3<=1)return a%3; return -1; } int n; vector v; typedef pair P; void FIN(P a,P b){ cout<<"Yes"<=0); int res=1; while(k){ if(k&1)res*=n; n*=n; k>>=1; } return res; } signed main(){ cin>>n; v.resize(n); for(int i=0;i>v[i]; if(n>=32)n=32; set

s; for(int j=0;jfirst==tmp)FIN(*s.upper_bound(P(tmp,j)),P(tmp,j)); if((--s.lower_bound(P(tmp,j)))->first==tmp)FIN(*--s.lower_bound(P(tmp,j)),P(tmp,j)); if(j)if(s.lower_bound(P(tmp,j))->first==tmp)FIN(*s.lower_bound(P(tmp,j)),P(tmp,j)); } cout<<"No"<