#include <bits/stdc++.h>   using namespace std;   void init() { return; }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     init();     int n;     cin >> n;     long long int a[n];     for (int i = 0; i < n; i++) {       cin >> a[i];     }     long long int ans = 0ll, prev = 0ll;     for (int i = 0; i < n; i++) {       long long int temp1 = min(a[i] / 2, prev);       long long int temp2 = (a[i] - 2 * temp1) / 3;       ans += temp1 + temp2;       prev += a[i] - 3 * (temp1 + temp2);     }     cout << ans << endl;     return 0;   }   