#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  double s;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    v.push_back(a);
    s += a;
  }
  s /= n;
  sort(v.begin(), v.end());
  int b = lower_bound(v.begin(), v.end(), (int)s) - v.begin();
  int ans = v[b];
  if (b >= 1 && s - (double)v[b - 1] < (double)ans - s) ans = v[b - 1];
  if (b < n - 1 && (double)v[b + 1] - s < (double)ans - s) ans = v[b + 1];
  cout << ans << endl;
}
