#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, n, m = 0, t;
  cin >> n;
  cin >> a;
  t = a;
  for (int i = 1; i < n; i++) {
    cin >> a;
    m = max(m, (a + t) / 2);
    t = a;
  }
  cout << m << endl;
  return 0;
}
