#include <bits/stdc++.h>
using namespace std;
#define LL long long
LL a[300005],sum[300005];
int main(){
    LL n;
    scanf("%lld",&n);
    for (LL i=1;i<=n;i++) scanf("%lld",&a[i]);
    for (LL i=1;i<=n;i++) sum[i]=sum[i-1]+a[i];
    LL need=0,ans=0;
    for (int i=n;i>0;i--){
        if (a[i]>=3 && a[i]%2==1){
            ans++;
            a[i]-=3;
        }
        if (a[i]==0) continue;
        if (a[i]==1) if (need>0) need--;
        LL x=a[i]/2;
        if (need+x>sum[i-1]){
            LL b=(sum[i-1]+2*x-need)/3LL;
            need+=b;
            ans+=b;
            break;
        }
        else{
            ans+=x;
            need+=x;
        }
    //cout<<i<<" "<<ans<<" "<<need<<" "<<sum[i-1]<<endl;
    }
    cout<<ans<<endl;
}
