// Distribution money.cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define LL long long #define lson l, m, rt<<1 #define rson m+1, r, rt<<1|1 #define PI 3.1415926535897932626 #define EXIT exit(0); #define PAUSE system("pause"); #define DEBUG puts("Here is a BUG"); #define SYNC_CLOSE ios::sync_with_stdio(false); #define what_is(x) cout << #x << " is " << x << endl; #define CLEAR(name, init) memset(name, init, sizeof(name)); const double eps = 1e-8; const int MAXN = (int)1e4 + 5; using namespace std; int main(int argc, char const *argv[]) { #ifndef ONLINE_JUDGE freopen("D:\\Documents\\Disk_Synchronous\\Programs\\Acm\\input.txt", "r", stdin); #endif int n; while(cin >> n) { int cnt[MAXN] = {0}; for(int i = 0; i < n; i++) { int tmp; scanf("%d", &tmp); cnt[tmp]++; } int res = -1; for(int i = 0; i < MAXN; i++) { if (cnt[i] > n - cnt[i]) { res = i; break; } } cout << res << endl; } return 0; }