#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
const int INF = 0x3f3f3f3f;
int arr[N];
int dq[N * 2];
int main() {
  int n;
  scanf("%d", &n);
  int dl = N, dr = N - 1;
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
    if (arr[i] == 1) {
      dr++;
      dq[dr] = i;
    }
  }
  long long ans = 0;
  int l = 0;
  for (int i = n - 1; i >= 0; i--) {
    int sz = dr - dl + 1;
    if (arr[i] >= 3 && (arr[i] & 1)) {
      ans++;
      arr[i] -= 3;
    }
    while (dl <= dr) {
      if (arr[i] <= 1) break;
      if (dq[dr] >= i) {
        dr--;
        continue;
      }
      arr[dq[dr]]--;
      arr[i] -= 2;
      ans++;
      dr--;
    }
    if (!arr[i]) continue;
    while (l < i) {
      if (!arr[l]) {
        l++;
        continue;
      }
      if (arr[l] * 2 >= arr[i]) {
        ans += arr[i] / 2;
        arr[l] -= arr[i] / 2;
        arr[i] = 0;
        if (arr[l] == 1) {
          dl--;
          dq[dl] = l;
        }
        break;
      } else {
        ans += arr[l];
        arr[i] -= arr[l] * 2;
        arr[l] = 0;
        l++;
      }
    }
    if (arr[i]) ans += arr[i] / 3;
  }
  printf("%I64d\n", ans);
  return 0;
}
