#include<iostream>
#include<conio.h>
#include<vector>
#include<queue>
#include<bits/stdc++.h>
#include<conio.h>
#include<cmath>
#include<string>
#include<stdio.h>
#include<algorithm>
#define ff first
#define ss second
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
using namespace std;
typedef long long ll;
typedef float fl;
typedef pair<int, int> pii;
typedef vector <int> vint;
typedef vector < pii > pvint;
typedef vector <bool> bvint;
typedef vector <vint> vvint;
const int inf=2e9;
int a[10000], t[400004];
void build_tree(int v, int tl, int tr){
if(tl==tr) t[v]=a[tl];
else{
int tm=(tl+tr)/2;
build_tree(v*2, tl ,tm);
build_tree(v*2+1, tm+1, tr);
t[v]=t[v*2]+t[v*2+1];
}
}
int sum(int v, int tl ,int tr, int l, int r){
if(l<=tl && tr<=r) return t[v];
if(l>tr||r<tl) return 0;
int tm=(tl+tr)/2;
return sum(v*2,tl,tm,l,r)+sum(v*2+1,tm+1,tr,l,r);
}
int main()
{
int n; cin>>n; for(int i=1;i<=n;i++) cin>>a[i];
build_tree(1, 1, 5);
cout<<sum(1,1,5,2,4)<<endl;
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGNvbmlvLmg+CiNpbmNsdWRlPHZlY3Rvcj4KI2luY2x1ZGU8cXVldWU+CiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlPGNvbmlvLmg+CiNpbmNsdWRlPGNtYXRoPgojaW5jbHVkZTxzdHJpbmc+CiNpbmNsdWRlPHN0ZGlvLmg+CiNpbmNsdWRlPGFsZ29yaXRobT4KI2RlZmluZSBmZiBmaXJzdAojZGVmaW5lIHNzIHNlY29uZAojZGVmaW5lIHBiKGEpIHB1c2hfYmFjayhhKQojZGVmaW5lIG1rKGEsYikgbWFrZV9wYWlyKGEsYikKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdHlwZWRlZiBsb25nIGxvbmcgbGw7CnR5cGVkZWYgZmxvYXQgZmw7CnR5cGVkZWYgcGFpcjxpbn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