#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
const int N=2*10e5;
//pair<pair<long , int> , long> t[2*N+1];
long a[N];
/*void push(int v)
{
    t[2*v].second=t[v].second;
    t[2*v+1].second=t[v].second;
}
long build(int v , int tl , int tr)
{
    //cout << v << " " << tl << " " << tr  << endl;
    if (tl==tr){
        t[v].first.first=a[tl];
        t[v].first.second=tl;
        t[v].second=0;
        return t[v].first.first;
    }
    long tm=(tr+tl)/2;
    t[v].first.first=min(build(v*2,tl,tm),build(v*2+1,tm+1,tr));
    t[v].second=0;
    if (t[v*2].first.first < t[v*2+1].first.first)
        t[v].first.second=t[v*2].first.second;
    else
        t[v].first.second=t[v*2+1].first.second;
    return t[v].first.first;
}
pair <pair<long,int>,int> minimum (int v , int tl , int tr , int l , int r){
    if (l>r)
        return mp(mp(INT_MAX-1,N+1),0);
    push(v);
    if (tl==l && tr==r)
        return mp(mp(t[v].first.first-t[v].second,t[v].first.second), t[v].second);
    int tm=(tl+tr)/2;
    pair <pair <long , int>,int> a=minimum(v*2,tl,tm,l,min(tm,r)),b=minimum(v*2+1,tm+1,tr,max(tm+1,l),r);
    if (a.first.first < b.first.first)
        return mp(mp(a.first.first , a.first.second),a.second);
    else
        return mp(mp(b.first.first , b.first.second),b.second);
}
int update(int v, int tl, int tr, int pos , int val){
    //cout << v << "  "<< tl << " " << tr << " " << pos << " " << val << endl;
    if (tl==tr){
        //cout << " asdasdasdas" << endl;
        a[tl]=val;
        t[v].first.first=val;
        t[v].first.second=pos;
    }
    else{
    long int tm=(tr+tl)/2;
    if (tm >= pos){
        update(v*2,tl,tm,pos,val);
    }
    else{
        update(v*2+1,tm+1,tr,pos,val);
    }
    t[v].first.first=min(t[v*2].first.first,t[v*2+1].first.first);
    if (t[v*2].first.first < t[v*2+1].first.first)
        t[v].first.second=t[v*2].first.second;
    else
        t[v].first.second=t[v*2+1].first.second;
    }
}
int deq(int v, int tl , int tr , int l , int r ,int val){
    if (l>r)
        return 0;
    if (tl==l && tr==r){
            t[v].second+=val;
            push(v);
    }
    else{
        int tm=(tl+tr)/2;
        deq(v*2,tl,tm,l,min(r,tm),val);
        push(v*2);
        deq(v*2+1,tm+1,tr,max(tm,l),r,val);
        push(v*2+1);
    }
}*/
int main()
{
    #ifdef LOCAL
    freopen ("input.txt","r",stdin);
    freopen ("output.txt","w",stdout);
    #endif // LOCAL
    int n;
    cin >> n;
    for (int i=0;i<n;i++){
        cin >> a[i];
    }
    //build(1,0,n-1);
    int sn=1;
    long long ans;
    //deque <pair<int,int>> seq;
  //  seq.push_back(mp(0,n-1));
    //update(1,0,n-1,4,10);
    //deq(1,0,n-1,0,n-1,3);
  //  cout << minimum(1,0,n-1,0,5).first.first << " " << minimum(1,0,n-1,0,5).first.second << " " << minimum(1,0,n-1,0,5).first.second << endl;;
    /*while (!seq.empty()){
        pair <pair <long , int> , int> p;
        p=minimum(1,0,n-1,seq[0].first,seq[0].second);
        ans+=p.first.first;
        update(1,0,n-1,p.first.second,INT_MAX);
        pair <int , int> p1=seq[0];
        seq.pop_front();
        if (p.first.second < p1.second && p.first.first > p1.first){
            seq.push_back(mp(p1.first,p.first.second));
            seq.push_back(mp(p.first.second+1,p.second));
        }
        else if (p.first.second == p1.second)
            seq.push_back(mp(p1.first,p.first.second));
        else if (p.first.second == p1.first)
            seq.push_back(mp(p.first.second,p1.second));
    }*/
    cout << 0;
}
