#include <bits/stdc++.h>
const int MAXINT = 2147483640;
const long long MAXLL = 9223372036854775800LL;
const long long MAXN = 1000000;
using namespace std;
long long x1[200000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  srand(time(0));
  long long n, i, x, s1, rez;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> x1[i];
  sort(x1 + 1, x1 + 1 + n);
  s1 = x1[n] - x1[1];
  rez = x1[1];
  for (i = 1; n >= i; i++) {
    x = max(x1[i] - x1[1], x1[n] - x1[i]);
    if (x < s1) s1 = x, rez = x1[i];
  }
  cout << rez << endl;
}
