#include <bits/stdc++.h>
using namespace std;
long n, i, t;
set<long> days;
int main() {
  cin >> n;
  for (i = 0; i < n * 2; i++) {
    cin >> t;
    days.insert(t);
  }
  long x = -1;
  if (n - 1 < days.size()) {
    set<long>::iterator it = days.begin();
    advance(it, n - 1);
    x = *it;
  }
  cout << x;
  return 0;
}
