#include using namespace std; typedef pair P; int main() { int n;cin>>n; map lr; vector unko(n,-1); for(int i = 0; i < n; i++){ int num;cin>>num; if(lr.count(num)==0)unko[i]=num; lr[num]=i; } priority_queue

que; for(int i=0;i=1){ que.push(make_pair(unko[i],lr[unko[i]])); } while(que.top().second