#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> arr(n);
  for (int i(0); i < n; i++) {
    cin >> arr[i];
  }
  if (n >= 3) {
    for (int i(0); i < n - 1; i++)
      for (int k(i + 1); k < n; k++) {
        if (arr[i] > arr[k]) swap(arr[i], arr[k]);
      }
    int sred = (arr[0] + arr[n - 1]) / 2;
    vector<int> arr1(n - 2);
    for (int i(1); i < n - 1; i++) {
      if ((sred - arr[i]) >= 0)
        arr1[i - 1] = sred - arr[i];
      else
        arr1[i - 1] = -sred + arr[i];
    }
    int min_l = arr[n - 1];
    int min;
    for (int i(0); i < n - 2; i++) {
      if (min_l > arr1[i]) {
        min_l = arr1[i];
        min = i;
      }
    }
    cout << arr[min + 1];
  } else if (n == 1)
    cout << arr[0];
  else if (n == 2)
    cout << arr[0];
}
