#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using INT = long long;
const int NN = 402020;
INT cnt[NN];
int main() {
  set<int> s, t;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", cnt + i);
    if (cnt[i] == 1)
      s.insert(i);
    else
      t.insert(i);
  }
  INT ans = 0;
  INT sum = 0;
  while (!s.empty() && !t.empty()) {
    auto p = *s.begin();
    s.erase(p);
    while (!t.empty()) {
      auto q = *t.begin();
      t.erase(q);
      if (p > q) {
        sum += cnt[q];
        continue;
      }
      cnt[q] -= 2;
      ans++;
      if (cnt[q] >= 2) {
        t.insert(q);
      } else if (cnt[q] == 1) {
        s.insert(q);
      }
      break;
    }
  }
  for (auto p : t) {
    sum += cnt[p];
  }
  ans += sum / 3;
  cout << ans;
  return 0;
}
