#include #include #include #include #include using namespace std; int a[10002]; int main () { int n,i; while (scanf("%d",&n) == 1) { memset(a,0,sizeof(a)); int temp; for (i = 0; i < n; i++) { scanf("%d",&temp); a[temp]++; } int ans = -1; for (i = 0; i <= 9999; i++) { if (a[i] > (n / 2)) { ans = i; break; } } printf("%d\n",ans); } return 0; }