#include <iostream>

#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

#include <cmath>
#include <algorithm>

#include <fstream>

using namespace std;

vector < int > to;
vector < int > from;
vector < int > pr;
vector < vector < int > > g;
int cur = 1;
vector < pair < int, int > > to_sum;

void dfs (int v, int p) {
    pr[v] = p;
    to_sum[v].first = cur;
    for (auto t: g[v]) {
        if (t != p) {
            to[t] = cur;
            from[cur] = t;
            cur++;
        }
    }
    to_sum[v].second = cur;
    for (auto t: g[v]) {
        if (t != p) {
            dfs(t, v);
        }
    }
    return;
}

const int mod = 1e9 + 7;

struct node {
    int l, r;
    int sum;
    int add;
};

void update (vector < node > &t, int v) {
    int v1 = v * 2 + 1;
    int v2 = v * 2 + 2;
    // *** //
    if (t[v].l + 1 == t[v].r) {
        return;
    }
    t[v].sum = (t[v1].sum + t[v2].sum) % mod;
}

void push (vector < node > &t, int v) {
    int v1 = v * 2 + 1;
    int v2 = v * 2 + 2;
    // *** //
    t[v].sum += t[v].add;
    t[v].sum %= mod;
    if (t[v].l + 1 == t[v].r) {
        t[v].add = 0;
        return;
    }
    t[v1].add = (t[v1].add + t[v].add) % mod;
    t[v2].add = (t[v2].add + t[v].add) % mod;
    t[v].add = 0;
}

void init (vector < node > &t, vector < int > &x, int v, int l, int r) {
    int v1 = v * 2 + 1;
    int v2 = v * 2 + 2;
    int dist = (r - l);
    // *** //
    // cout << v << " " << l << " " << r<< endl;
    t[v].l = l;
    t[v].r = r;
    t[v].sum = 0;
    t[v].add = 0;
    if (t[v].l + 1 == t[v].r) {
        t[v].sum = (x[t[v].l]) % mod;
        return;
    }
    init(t, x, v1, l, l + dist / 2);
    init(t, x, v2, l + dist / 2, r);
    update(t, v);
}

void Add (vector < node > &t, int v, int l, int r, int add) {
    int v1 = v * 2 + 1;
    int v2 = v * 2 + 2;
    // *** //
    push(t, v);
    if (t[v].l >= r || t[v].r <= l) {
        return;
    }
    if (l <= t[v].l && t[v].r <= r) {
        t[v].add += add;
        push(t, v);
        return;
    }
    Add(t, v1, l, r, add);
    Add(t, v2, l, r, add);
    update(t, v);
}

int Sum (vector < node > &t, int v, int l, int r) {
    int v1 = v * 2 + 1;
    int v2 = v * 2 + 2;
    // *** //
    push(t, v);
    if (t[v].l >= r || t[v].r <= l) {
        return 0;
    }
    if (l <= t[v].l && t[v].r <= r) {
        return t[v].sum;
    }
    int res = (Sum(t, v1, l, r) + Sum(t, v2, l, r)) % mod;
    update(t, v);
    return res;
}

void print_tree (vector < node > &t, int v) {
    int v1 = v * 2 + 1;
    int v2 = v * 2 + 2;
    // *** //
    cout << v << " " << t[v].l << " " << t[v].r << " " << t[v].sum << " " << t[v].add << endl;
    if (t[v].l + 1 == t[v].r) {
        return;
    }
    print_tree(t, v1);
    print_tree(t, v2);
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    cout.setf(ios_base::fixed);
    cout.precision(28);


    int n;
    cin >> n;
    int last = 0;
    long long ans = 0;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        int k = (a + last) / 2;
        ans += k;
        if (k == 0) {
            last = a;
        } else {
            last = (a + last) - k * 2;
        }
        //cout << ans << endl;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 384