#include <iostream> using namespace std; int main(){ int n,i,j,num; num = 0; int b[100] = {100000}; int count = 0; int counter = 0; cin>>n; int *a = new int(n); for (i = 0; i < n; i++) { cin>>a[i]; } for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { if (a[i] == a[j]) count++; if(count >= counter){ counter = count; b[i] = a[i]; } } } j = b[0]; for (i = 0; i < num; i++) { if (b[i] < j) { j = b[i]; } //cout<<b[i]<<endl; } cout<<j<<endl; return 0; }