#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long n,zbir=0;
    cin>>n;
    vector<long long>niza(n);
    for(long long i=0;i<n;i++){
        cin>>niza[i];
        zbir+=niza[i];
    }
    cout<<zbir/2;
    return 0;
    long long zbirs=0,zbirm=0,rez=1e9;
    for(int i=0;i<n;i++){
        if(zbir/2>=zbirs+niza[i]){
            zbirs+=niza[i];
        }
        else{
            zbirm=zbir-zbirs;
            rez=min(rez,abs(zbirs-zbirm));
        }
    }
    cout<<rez;
    return 0;
}
