#include <bits/stdc++.h>
using namespace std;
using pr = pair<int64_t, int64_t>;
using vp = vector<pr>;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  map<int64_t, int64_t> mp;
  for (int i = 0; i < n; i++) {
    int64_t a;
    cin >> a;
    mp[a]++;
  }
  vp v;
  for (auto& p : mp) v.push_back(p);
  int N = v.size();
  if (N == 1) {
    cout << v[0].first << endl;
    return 0;
  }
  vp l(N);
  vp r(N);
  l[0].second = v[0].second;
  for (int i = 1; i < N; i++) {
    int64_t dist = v[i].first - v[i - 1].first;
    l[i].first = l[i - 1].first + dist * l[i - 1].second;
    l[i].second = l[i - 1].second + v[i].second;
  }
  r[N - 1].second = v[N - 1].second;
  for (int i = N - 2; i >= 0; i--) {
    int64_t dist = v[i + 1].first - v[i].first;
    r[i].first = r[i + 1].first + dist * r[i + 1].second;
    r[i].second = r[i + 1].second + v[i].second;
  }
  int64_t sum = LLONG_MAX;
  int64_t ans = 0;
  for (int i = 0; i < N; i++) {
    if (l[i].first + r[i].first < sum) {
      sum = l[i].first + r[i].first;
      ans = v[i].first;
    }
  }
  cout << ans << endl;
  return 0;
}
