#include #include #include #include #include #include #include using namespace std; const int maxn = 10010; int peo[maxn]; int main() { int n; while(~scanf("%d", &n)) { int tmp, max = -1; int num = 0; memset(peo, 0, sizeof(peo)); for(int i = 0; i < n; i++) { scanf("%d", &tmp); peo[tmp]++; // printf("%d", max); if(max < peo[tmp]) { max = peo[tmp]; num = tmp; } } if(max > n - max) { printf("%d\n", num); } else { printf("-1\n"); } } }