#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < N; ++i) cin >> a[i];
  priority_queue<int, vector<int>, greater<int> > que;
  for (int i = 0; i < N; ++i)
    if (a[i] >= 2) que.push(i);
  long long res = 0;
  for (int i = 0; i < N; ++i) {
    res += a[i] / 3;
    a[i] %= 3;
    if (a[i] == 0)
      continue;
    else if (a[i] == 1) {
      while (!que.empty() && que.top() <= i) que.pop();
      if (que.empty()) continue;
      int j = que.top();
      que.pop();
      res++;
      a[j] -= 2;
      if (a[j] >= 2) que.push(j);
    } else if (a[i] == 2) {
      for (int iter = 0; iter < 2; ++iter) {
        while (!que.empty() && que.top() <= i) que.pop();
        if (que.empty()) continue;
        int j = que.top();
        que.pop();
        res++;
        a[j] -= 2;
        if (a[j] >= 2) que.push(j);
      }
    }
  }
  cout << res << endl;
}
