#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
int a[maxn];
long long ans;
int n;
long long solve(long long m) {
  long long totX = 0, totY = 0;
  for (int i = n - 1; i >= 0; i--) {
    int cur = a[i] / 2;
    cur = min((long long)cur, m);
    m -= cur;
    int rem = a[i] - cur * 2;
    totY += rem;
    totX += cur;
  }
  if (m > 0) return -1;
  ans = max(ans, min(totX, totY));
  return totY - totX;
}
void normalize() {
  int tot = 0;
  for (int i = n - 1; i >= 0; i--) {
    tot += a[i] / 2;
    if (a[i] % 2) {
      if (!tot)
        a[i]--;
      else
        tot--;
    }
  }
}
int main() {
  cin >> n;
  long long s = 0;
  for (int i = (0); i < (n); i++) {
    cin >> a[i];
    s += a[i];
  }
  normalize();
  long long l = 0, r = s / 2, found = -1;
  while (l <= r) {
    long long m = (l + r) >> 1;
    if (solve(m) <= 0) {
      r = m - 1;
      found = m;
    } else {
      l = m + 1;
    }
  }
  solve(found);
  solve(found - 1);
  cout << ans;
  return 0;
}
