#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  int n;
  int a[100];
  float ave = 0.0f;
  int sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  ave = (float)sum / (float)n;
  map<float, int> m;
  for (int i = 0; i < n; i++) {
    float diff = fabs((float)ave - (float)a[i]);
    m[diff]++;
  }
  if (m.size() == 1) {
    cout << "0" << endl;
  } else {
    int max = 0;
    float max_idx = 0;
    for (map<float, int>::iterator it = m.begin(); it != m.end(); it++) {
      if (max < it->second) {
        max = it->second;
        max_idx = it->first;
      }
    }
    for (int i = 0; i < n; i++) {
      if (fabs(a[i] - ave) == (float)max_idx) {
        cout << a[i] << endl;
        break;
      }
    }
  }
  return 0;
}
