#include <bits/stdc++.h>
namespace ringo {
template <class T>
inline void read(T &x) {
  x = 0;
  register char c = getchar();
  register bool f = 0;
  while (!isdigit(c)) f ^= c == '-', c = getchar();
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  if (f) x = -x;
}
template <class T>
inline void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar('0' + x % 10);
}
template <class T>
inline void print(T x, char c) {
  print(x), putchar(c);
}
const int N = 3e5 + 10;
int n, a[N], b[N], c[N];
long long l, r, mid, sum, ans, lst;
bool check(long long now) {
  lst = now;
  for (int i = n; i >= 1; i--) {
    b[i] = std::min(lst, (long long)(a[i] >> 1));
    c[i] = a[i] - (b[i] << 1);
    lst -= b[i];
  }
  if (lst) return false;
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += c[i] - b[i];
    if (sum < 0) return false;
  }
  return true;
}
void main() {
  read(n);
  for (int i = 1; i <= n; i++) read(a[i]);
  for (int i = 1; i <= n; i++) sum += a[i];
  l = 1, r = sum / 3;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid))
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  print(ans, '\n');
}
}  // namespace ringo
signed main() { return ringo::main(), 0; }
