    #include <iostream>
    using namespace std;

    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef vector<long long> vl;
    typedef vector<int> vi;
    #define PB push_back
    #define MP make_pair
    #define ln "\n"
    #define max(a, b) (a < b ? b : a)
    #define min(a, b) ((a > b) ? b : a)
    #define mod 1e9 + 7
    #define forn(i,e) for(ll i=0; i<e; i++)
    #define forsn(i,s,e) for(ll i=s; i<e; i++)
    #define rforn(i,e) for(ll i=e; i>=0; i--)
    #define rforsn(i,s,e) for(ll i=s; i>=e; i--)
    #define vasort(v) sort(v.begin(), v.end())
    #define vdsort(v) sort(v.begin(), v.end(),greater<ll>())
    #define F first
    #define S second

    #define out1(x1) cout << x1 << ln
    #define out2(x1,x2) cout << x1 << " " << x2 << ln
    #define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << ln
    #define out4(x1,x2,x3,x4) cout << x1 << " " << x2 << " " << x3 << " " << x4 << ln
    #define out5(x1,x2,x3,x4,x5) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << ln
    #define out6(x1,x2,x3,x4,x5,x6) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << " " << x6 << ln

    #define in1(x1) cin >> x1
    #define in2(x1,x2) cin >> x1 >> x2
    #define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
    #define in4(x1,x2,x3,x4) cin >> x1 >> x2 >> x3 >> x4
    #define in5(x1,x2,x3,x4,x5) cin >> x1 >> x2 >> x3 >> x4 >> x5
    #define in6(x1,x2,x3,x4,x5,x6) cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6

    #define arrin(a,n) forn(i,n) cin >> a[i];
    #define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << ln;

    #define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    int nxt() {int x; cin >> x; return x;}
    const ll INF = ll(1e17) + 99;
    ll gcd(ll a, ll b)  {if (b == 0) return a;  return gcd(b, a % b);  }
    ll fact(ll n)    {ll t=1;if(n==0 ||n==1) return t; for(int i=2;i<=n;i++) t*=i; return t;}
    const int N = int(2e5) + 99;
    vi plist;
    void SieveOfEratosthenes(int n)
    {
        // Create a boolean array "prime[0..n]" and initialize
        // all entries it as true. A value in prime[i] will
        // finally be false if i is Not a prime, else true.
        bool prime[n+1];
        memset(prime, true, sizeof(prime));

        for (int p=2; p*p<=n; p++)
        {
            // If prime[p] is not changed, then it is a prime
            if (prime[p] == true)
            {
                // Update all multiples of p greater than or
                // equal to the square of it
                // numbers which are multiple of p and are
                // less than p^2 are already been marked.
                for (int i=p*p; i<=n; i += p)
                    prime[i] = false;
            }
        }

        // Print all prime numbers
        for (int p=2; p<=n; p++)
           if (prime[p])
              plist.PB(p);
    }
    ll power(ll x,  ll y, ll p)
    {
        ll res = 1;     // Initialize result

        x = x % p; // Update x if it is more than or
                    // equal to p

        if (x == 0) return 0; // In case x is divisible by p;

        while (y > 0)
        {
            // If y is odd, multiply x with result
            if (y & 1)
                res = (res*x) % p;

            // y must be even now
            y = y>>1; // y = y/2
            x = (x*x) % p;
        }
        return res;
    }
    int _mergeSort(int arr[], int temp[], int left, int right);
    int merge(int arr[], int temp[], int left, int mid, int right);

    /* This function sorts the input array and returns the
    number of inversions in the array */
    int mergeSort(int arr[], int array_size)
    {
        int temp[array_size];
        return _mergeSort(arr, temp, 0, array_size - 1);
    }

    /* An auxiliary recursive function that sorts the input array and
    returns the number of inversions in the array. */
    int _mergeSort(int arr[], int temp[], int left, int right)
    {
        int mid, inv_count = 0;
        if (right > left) {
            /* Divide the array into two parts and
            call _mergeSortAndCountInv()
            for each of the parts */
            mid = (right + left) / 2;

            /* Inversion count will be sum of
            inversions in left-part, right-part
            and number of inversions in merging */
            inv_count += _mergeSort(arr, temp, left, mid);
            inv_count += _mergeSort(arr, temp, mid + 1, right);

            /*Merge the two parts*/
            inv_count += merge(arr, temp, left, mid + 1, right);
        }
        return inv_count;
    }

    /* This funt merges two sorted arrays
    and returns inversion count in the arrays.*/
    int merge(int arr[], int temp[], int left,
              int mid, int right)
    {
        int i, j, k;
        int inv_count = 0;

        i = left; /* i is index for left subarray*/
        j = mid; /* j is index for right subarray*/
        k = left; /* k is index for resultant merged subarray*/
        while ((i <= mid - 1) && (j <= right)) {
            if (arr[i] <= arr[j]) {
                temp[k++] = arr[i++];
            }
            else {
                temp[k++] = arr[j++];

                /* this is tricky -- see above
                explanation/diagram for merge()*/
                inv_count = inv_count + (mid - i);
            }
        }

        /* Copy the remaining elements of left subarray
    (if there are any) to temp*/
        while (i <= mid - 1)
            temp[k++] = arr[i++];

        /* Copy the remaining elements of right subarray
    (if there are any) to temp*/
        while (j <= right)
            temp[k++] = arr[j++];

        /*Copy back the merged elements to original array*/
        for (i = left; i <= right; i++)
            arr[i] = temp[i];

        return inv_count;
    }
    ll binomialCoeff(ll n, ll k)
    {
        ll res = 1;

        // Since C(n, k) = C(n, n-k)
        if (k > n - k)
            k = n - k;

        // Calculate value of
        // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]
        for (ll i = 0; i < k; ++i) {
            res *= (n - i);
            res /= (i + 1);
        }

        return res;
    }const ll MAXN = 100001;

    ll spf[MAXN];
    void sieve()
    {
        spf[1] = 1;
        for (ll i=2; i<MAXN; i++)  spf[i] = i;
        for (ll i=4; i<MAXN; i+=2) spf[i] = 2;

        for (ll i=3; i*i<MAXN; i++) {
            if (spf[i] == i) {
                for (ll j=i*i; j<MAXN; j+=i)
                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }
    map<ll,ll> getFactorization(ll x){    map<ll,ll> ret; while (x != 1) {ret[spf[x]]++;   x = x / spf[x];}return ret;}

    bool sortbysec(const pair<int,int> &a,
                  const pair<int,int> &b)
    {
        return (a.second < b.second);
    }
    /*-----------------------------Code begins------------------------*/
     bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
    {
       return (a.first > b.first);
    }
    ll ans2=0,ans3=0;
   void  func(ll x,ll y,ll b[])
    {   x--;
        if(b[x]>0)
        {
            ans2-=b[x];
        }
        else ans3+=b[x];
        b[x]+=y;
        if(b[x]>0)
        {
            ans2+=b[x];

        }
        else ans3-=b[x];

    }

    void solve()
    {
        ll l,r,g,n,x,y,m,ans1=6e16+7,ans13=0,
        value,ans4=0,flag1=0,ans5=0,ans6=0,k;
        cin>>n;
        ll a[n];
        arrin(a,n);
        ll q;
        cin>>q;k=0;
         if(n==1)
        {    r=ceil(double(a[0])/2.0);
          cout<<r<<ln;

        forn(i,q)
        {
            cin>> l>>r>>x;
            //update(1, 0, n-1, l,  r, x);
            a[0]+=x;
            r=ceil(double(a[0]/2.0));
            cout<<r<<ln;

        }return;

        }ll a1=a[0];
        ll b[n+1];b[0]=a[0];
        forn(i,n-1)
        {
            if(a[i+1]-a[i]>0)
                ans2+=a[i+1]-a[i];
            else
                ans3+=-a[i+1]+a[i];
            b[i+1]=a[i+1]-a[i];
        }

            cout<<ll(ceil(double(a1+ans2)/2.0))<<ln;
        forn(i,q)
        {
            cin>>l>>r>>x;
            if(l==1)
            {
                a1+=x;
            }
            else
            func(l,x,b);
            if(r!=n)
                func(r+1,-x,b);
            cout<<ll(ceil(double(a1+ans2)/2.0))<<ln;

        }

    }

    int main() {
        #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        //freopen("error.txt","w",stderr);
        #endif
        zoom;
        //SieveOfEratosthenes(1000007);
         ll t=1;

        //in1(t);
         while(t--) {
            solve();cout<<ln;
         }

        return 0;
    }


    #include <iostream>
    using namespace std;

    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef vector<long long> vl;
    typedef vector<int> vi;
    #define PB push_back
    #define MP make_pair
    #define ln "\n"
    #define max(a, b) (a < b ? b : a)
    #define min(a, b) ((a > b) ? b : a)
    #define mod 1e9 + 7
    #define forn(i,e) for(ll i=0; i<e; i++)
    #define forsn(i,s,e) for(ll i=s; i<e; i++)
    #define rforn(i,e) for(ll i=e; i>=0; i--)
    #define rforsn(i,s,e) for(ll i=s; i>=e; i--)
    #define vasort(v) sort(v.begin(), v.end())
    #define vdsort(v) sort(v.begin(), v.end(),greater<ll>())
    #define F first
    #define S second

    #define out1(x1) cout << x1 << ln
    #define out2(x1,x2) cout << x1 << " " << x2 << ln
    #define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << ln
    #define out4(x1,x2,x3,x4) cout << x1 << " " << x2 << " " << x3 << " " << x4 << ln
    #define out5(x1,x2,x3,x4,x5) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << ln
    #define out6(x1,x2,x3,x4,x5,x6) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << " " << x6 << ln

    #define in1(x1) cin >> x1
    #define in2(x1,x2) cin >> x1 >> x2
    #define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
    #define in4(x1,x2,x3,x4) cin >> x1 >> x2 >> x3 >> x4
    #define in5(x1,x2,x3,x4,x5) cin >> x1 >> x2 >> x3 >> x4 >> x5
    #define in6(x1,x2,x3,x4,x5,x6) cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6

    #define arrin(a,n) forn(i,n) cin >> a[i];
    #define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << ln;

    #define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    int nxt() {int x; cin >> x; return x;}
    const ll INF = ll(1e17) + 99;
    ll gcd(ll a, ll b)  {if (b == 0) return a;  return gcd(b, a % b);  }
    ll fact(ll n)    {ll t=1;if(n==0 ||n==1) return t; for(int i=2;i<=n;i++) t*=i; return t;}
    const int N = int(2e5) + 99;
    vi plist;
    void SieveOfEratosthenes(int n)
    {
        // Create a boolean array "prime[0..n]" and initialize
        // all entries it as true. A value in prime[i] will
        // finally be false if i is Not a prime, else true.
        bool prime[n+1];
        memset(prime, true, sizeof(prime));

        for (int p=2; p*p<=n; p++)
        {
            // If prime[p] is not changed, then it is a prime
            if (prime[p] == true)
            {
                // Update all multiples of p greater than or
                // equal to the square of it
                // numbers which are multiple of p and are
                // less than p^2 are already been marked.
                for (int i=p*p; i<=n; i += p)
                    prime[i] = false;
            }
        }

        // Print all prime numbers
        for (int p=2; p<=n; p++)
           if (prime[p])
              plist.PB(p);
    }
    ll power(ll x,  ll y, ll p)
    {
        ll res = 1;     // Initialize result

        x = x % p; // Update x if it is more than or
                    // equal to p

        if (x == 0) return 0; // In case x is divisible by p;

        while (y > 0)
        {
            // If y is odd, multiply x with result
            if (y & 1)
                res = (res*x) % p;

            // y must be even now
            y = y>>1; // y = y/2
            x = (x*x) % p;
        }
        return res;
    }
    int _mergeSort(int arr[], int temp[], int left, int right);
    int merge(int arr[], int temp[], int left, int mid, int right);

    /* This function sorts the input array and returns the
    number of inversions in the array */
    int mergeSort(int arr[], int array_size)
    {
        int temp[array_size];
        return _mergeSort(arr, temp, 0, array_size - 1);
    }

    /* An auxiliary recursive function that sorts the input array and
    returns the number of inversions in the array. */
    int _mergeSort(int arr[], int temp[], int left, int right)
    {
        int mid, inv_count = 0;
        if (right > left) {
            /* Divide the array into two parts and
            call _mergeSortAndCountInv()
            for each of the parts */
            mid = (right + left) / 2;

            /* Inversion count will be sum of
            inversions in left-part, right-part
            and number of inversions in merging */
            inv_count += _mergeSort(arr, temp, left, mid);
            inv_count += _mergeSort(arr, temp, mid + 1, right);

            /*Merge the two parts*/
            inv_count += merge(arr, temp, left, mid + 1, right);
        }
        return inv_count;
    }

    /* This funt merges two sorted arrays
    and returns inversion count in the arrays.*/
    int merge(int arr[], int temp[], int left,
              int mid, int right)
    {
        int i, j, k;
        int inv_count = 0;

        i = left; /* i is index for left subarray*/
        j = mid; /* j is index for right subarray*/
        k = left; /* k is index for resultant merged subarray*/
        while ((i <= mid - 1) && (j <= right)) {
            if (arr[i] <= arr[j]) {
                temp[k++] = arr[i++];
            }
            else {
                temp[k++] = arr[j++];

                /* this is tricky -- see above
                explanation/diagram for merge()*/
                inv_count = inv_count + (mid - i);
            }
        }

        /* Copy the remaining elements of left subarray
    (if there are any) to temp*/
        while (i <= mid - 1)
            temp[k++] = arr[i++];

        /* Copy the remaining elements of right subarray
    (if there are any) to temp*/
        while (j <= right)
            temp[k++] = arr[j++];

        /*Copy back the merged elements to original array*/
        for (i = left; i <= right; i++)
            arr[i] = temp[i];

        return inv_count;
    }
    ll binomialCoeff(ll n, ll k)
    {
        ll res = 1;

        // Since C(n, k) = C(n, n-k)
        if (k > n - k)
            k = n - k;

        // Calculate value of
        // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]
        for (ll i = 0; i < k; ++i) {
            res *= (n - i);
            res /= (i + 1);
        }

        return res;
    }const ll MAXN = 100001;

    ll spf[MAXN];
    void sieve()
    {
        spf[1] = 1;
        for (ll i=2; i<MAXN; i++)  spf[i] = i;
        for (ll i=4; i<MAXN; i+=2) spf[i] = 2;

        for (ll i=3; i*i<MAXN; i++) {
            if (spf[i] == i) {
                for (ll j=i*i; j<MAXN; j+=i)
                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }
    map<ll,ll> getFactorization(ll x){    map<ll,ll> ret; while (x != 1) {ret[spf[x]]++;   x = x / spf[x];}return ret;}

    bool sortbysec(const pair<int,int> &a,
                  const pair<int,int> &b)
    {
        return (a.second < b.second);
    }
    /*-----------------------------Code begins------------------------*/
     bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
    {
       return (a.first > b.first);
    }
    ll ans2=0,ans3=0;
   void  func(ll x,ll y,ll b[])
    {   x--;
        if(b[x]>0)
        {
            ans2-=b[x];
        }
        else ans3+=b[x];
        b[x]+=y;
        if(b[x]>0)
        {
            ans2+=b[x];

        }
        else ans3-=b[x];

    }

    void solve()
    {
        ll l,r,g,n,x,y,m,ans1=6e16+7,ans13=0,
        value,ans4=0,flag1=0,ans5=0,ans6=0,k;
        cin>>n;
        ll a[n];
        arrin(a,n);
        ll q;
        cin>>q;k=0;
         if(n==1)
            r=ceil(double((a[0])/2.0));
        {   cout<<r<<ln;

        forn(i,q)
        {
            cin>> l>>r>>x;
            //update(1, 0, n-1, l,  r, x);
            a[0]+=x;
            r=ceil(double((a[0])/2.0));
            cout<<r<<ln;

        }return;

        }ll a1=a[0];
        ll b[n+1];b[0]=a[0];
        forn(i,n-1)
        {
            if(a[i+1]-a[i]>0)
                ans2+=a[i+1]-a[i];
            else
                ans3+=-a[i+1]+a[i];
            b[i+1]=a[i+1]-a[i];
        }

            cout<<ceil(double((a1+ans2)/2.0))<<ln;
        forn(i,q)
        {
            cin>>l>>r>>x;
            if(l==1)
            {
                a1+=x;
            }
            else
            func(l,x,b);
            if(r!=n)
                func(r+1,-x,b);
            cout<<ceil(double((a1+ans2)/2.0))<<ln;

        }

    }

    int main() {
        #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        //freopen("error.txt","w",stderr);
        #endif
        zoom;
        //SieveOfEratosthenes(1000007);
         ll t=1;

        //in1(t);
         while(t--) {
            solve();cout<<ln;
         }

        return 0;
    }


    #include <iostream>
    using namespace std;

    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef vector<long long> vl;
    typedef vector<int> vi;
    #define PB push_back
    #define MP make_pair
    #define ln "\n"
    #define max(a, b) (a < b ? b : a)
    #define min(a, b) ((a > b) ? b : a)
    #define mod 1e9 + 7
    #define forn(i,e) for(ll i=0; i<e; i++)
    #define forsn(i,s,e) for(ll i=s; i<e; i++)
    #define rforn(i,e) for(ll i=e; i>=0; i--)
    #define rforsn(i,s,e) for(ll i=s; i>=e; i--)
    #define vasort(v) sort(v.begin(), v.end())
    #define vdsort(v) sort(v.begin(), v.end(),greater<ll>())
    #define F first
    #define S second

    #define out1(x1) cout << x1 << ln
    #define out2(x1,x2) cout << x1 << " " << x2 << ln
    #define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << ln
    #define out4(x1,x2,x3,x4) cout << x1 << " " << x2 << " " << x3 << " " << x4 << ln
    #define out5(x1,x2,x3,x4,x5) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << ln
    #define out6(x1,x2,x3,x4,x5,x6) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << " " << x6 << ln

    #define in1(x1) cin >> x1
    #define in2(x1,x2) cin >> x1 >> x2
    #define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
    #define in4(x1,x2,x3,x4) cin >> x1 >> x2 >> x3 >> x4
    #define in5(x1,x2,x3,x4,x5) cin >> x1 >> x2 >> x3 >> x4 >> x5
    #define in6(x1,x2,x3,x4,x5,x6) cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6

    #define arrin(a,n) forn(i,n) cin >> a[i];
    #define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << ln;

    #define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    int nxt() {int x; cin >> x; return x;}
    const ll INF = ll(1e17) + 99;
    ll gcd(ll a, ll b)  {if (b == 0) return a;  return gcd(b, a % b);  }
    ll fact(ll n)    {ll t=1;if(n==0 ||n==1) return t; for(int i=2;i<=n;i++) t*=i; return t;}
    const int N = int(2e5) + 99;
    vi plist;
    void SieveOfEratosthenes(int n)
    {
        // Create a boolean array "prime[0..n]" and initialize
        // all entries it as true. A value in prime[i] will
        // finally be false if i is Not a prime, else true.
        bool prime[n+1];
        memset(prime, true, sizeof(prime));

        for (int p=2; p*p<=n; p++)
        {
            // If prime[p] is not changed, then it is a prime
            if (prime[p] == true)
            {
                // Update all multiples of p greater than or
                // equal to the square of it
                // numbers which are multiple of p and are
                // less than p^2 are already been marked.
                for (int i=p*p; i<=n; i += p)
                    prime[i] = false;
            }
        }

        // Print all prime numbers
        for (int p=2; p<=n; p++)
           if (prime[p])
              plist.PB(p);
    }
    ll power(ll x,  ll y, ll p)
    {
        ll res = 1;     // Initialize result

        x = x % p; // Update x if it is more than or
                    // equal to p

        if (x == 0) return 0; // In case x is divisible by p;

        while (y > 0)
        {
            // If y is odd, multiply x with result
            if (y & 1)
                res = (res*x) % p;

            // y must be even now
            y = y>>1; // y = y/2
            x = (x*x) % p;
        }
        return res;
    }
    int _mergeSort(int arr[], int temp[], int left, int right);
    int merge(int arr[], int temp[], int left, int mid, int right);

    /* This function sorts the input array and returns the
    number of inversions in the array */
    int mergeSort(int arr[], int array_size)
    {
        int temp[array_size];
        return _mergeSort(arr, temp, 0, array_size - 1);
    }

    /* An auxiliary recursive function that sorts the input array and
    returns the number of inversions in the array. */
    int _mergeSort(int arr[], int temp[], int left, int right)
    {
        int mid, inv_count = 0;
        if (right > left) {
            /* Divide the array into two parts and
            call _mergeSortAndCountInv()
            for each of the parts */
            mid = (right + left) / 2;

            /* Inversion count will be sum of
            inversions in left-part, right-part
            and number of inversions in merging */
            inv_count += _mergeSort(arr, temp, left, mid);
            inv_count += _mergeSort(arr, temp, mid + 1, right);

            /*Merge the two parts*/
            inv_count += merge(arr, temp, left, mid + 1, right);
        }
        return inv_count;
    }

    /* This funt merges two sorted arrays
    and returns inversion count in the arrays.*/
    int merge(int arr[], int temp[], int left,
              int mid, int right)
    {
        int i, j, k;
        int inv_count = 0;

        i = left; /* i is index for left subarray*/
        j = mid; /* j is index for right subarray*/
        k = left; /* k is index for resultant merged subarray*/
        while ((i <= mid - 1) && (j <= right)) {
            if (arr[i] <= arr[j]) {
                temp[k++] = arr[i++];
            }
            else {
                temp[k++] = arr[j++];

                /* this is tricky -- see above
                explanation/diagram for merge()*/
                inv_count = inv_count + (mid - i);
            }
        }

        /* Copy the remaining elements of left subarray
    (if there are any) to temp*/
        while (i <= mid - 1)
            temp[k++] = arr[i++];

        /* Copy the remaining elements of right subarray
    (if there are any) to temp*/
        while (j <= right)
            temp[k++] = arr[j++];

        /*Copy back the merged elements to original array*/
        for (i = left; i <= right; i++)
            arr[i] = temp[i];

        return inv_count;
    }
    ll binomialCoeff(ll n, ll k)
    {
        ll res = 1;

        // Since C(n, k) = C(n, n-k)
        if (k > n - k)
            k = n - k;

        // Calculate value of
        // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]
        for (ll i = 0; i < k; ++i) {
            res *= (n - i);
            res /= (i + 1);
        }

        return res;
    }const ll MAXN = 100001;

    ll spf[MAXN];
    void sieve()
    {
        spf[1] = 1;
        for (ll i=2; i<MAXN; i++)  spf[i] = i;
        for (ll i=4; i<MAXN; i+=2) spf[i] = 2;

        for (ll i=3; i*i<MAXN; i++) {
            if (spf[i] == i) {
                for (ll j=i*i; j<MAXN; j+=i)
                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }
    map<ll,ll> getFactorization(ll x){    map<ll,ll> ret; while (x != 1) {ret[spf[x]]++;   x = x / spf[x];}return ret;}

    bool sortbysec(const pair<int,int> &a,
                  const pair<int,int> &b)
    {
        return (a.second < b.second);
    }
    /*-----------------------------Code begins------------------------*/
     bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
    {
       return (a.first > b.first);
    }
    ll ans2=0,ans3=0;
   void  func(ll x,ll y,ll b[])
    {   x--;
        if(b[x]>0)
        {
            ans2-=b[x];
        }
        else ans3+=b[x];
        b[x]+=y;
        if(b[x]>0)
        {
            ans2+=b[x];

        }
        else ans3-=b[x];

    }

    void solve()
    {
        ll l,r,g,n,x,y,m,ans1=6e16+7,ans13=0,
        value,ans4=0,flag1=0,ans5=0,ans6=0,k;
        cin>>n;
        ll a[n];
        arrin(a,n);
        ll q;
        cin>>q;k=0;
         if(n==1)
        {   cout<<(a[0]+1)/2<<ln;
            ll q;
        cin>>q;
        forn(i,q)
        {
            cin>> l>>r>>x;
            //update(1, 0, n-1, l,  r, x);
            a[0]+=x;
            cout<<(a[0]+1)/2<<ln;

        }return;

        }ll a1=a[0];
        ll b[n+1];b[0]=a[0];
        forn(i,n-1)
        {
            if(a[i+1]-a[i]>0)
                ans2+=a[i+1]-a[i];
            else
                ans3+=-a[i+1]+a[i];
            b[i+1]=a[i+1]-a[i];
        }

            cout<<(a1+ans2+1)/2<<ln;
        forn(i,q)
        {
            cin>>l>>r>>x;
            if(l==1)
            {
                a1+=x;
            }
            else
            func(l,x,b);
            if(r!=n)
                func(r+1,-x,b);
            cout<<(a1+ans2+1)/2<<ln;

        }

    }

    int main() {
        #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        //freopen("error.txt","w",stderr);
        #endif
        zoom;
        //SieveOfEratosthenes(1000007);
         ll t=1;

        //in1(t);
         while(t--) {
            solve();cout<<ln;
         }

        return 0;
    }


#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 10;

int n;
long long a[N], b[N];
long long sum;

void enter_array(){
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i];
}

int get(){
    return((sum + a[0] + 1) / 2);
}

void update(int l, int r, int val){
    if (l > 0){
        sum -= max(0ll, b[l]);
        b[l] += val;
        sum += max(0ll, b[l]);
    }

    if (r < n - 1){
        sum -= max(0ll, b[r + 1]);
        b[r + 1] -= val;
        sum += max(0ll, b[r + 1]);
    }
}

void cal_sum(){
    for(int i = 1; i < n; i++){
        b[i] = a[i] - a[i - 1];
        sum += max(0ll, b[i]);
    }

    cout << get() << "\n";
}

void enter_and_solve_query(){
    int q, l, r, val;

    cin >> q;
    for(int i = 0; i < q; i++){
        cin >> l >> r >> val;
        update(l - 1, r - 1, val);
        cout << get() << "\n";
    }
}

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

    enter_array();
    cal_sum();
    enter_and_solve_query();
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 10;

int n;
long long a[N], b[N];
long long sum;

void enter_array(){
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i];
}

long long get(){
    long long x = (sum + a[0]) / 2;
    return(max(x, a[0] + sum - x));
}

void update(int l, int r, int val){
    if (l == 0)
        a[l] += val;

    if (l > 0){
        sum -= max(0ll, b[l]);
        b[l] += val;
        sum += max(0ll, b[l]);
    }

    if (r < n - 1){
        sum -= max(0ll, b[r + 1]);
        b[r + 1] -= val;
        sum += max(0ll, b[r + 1]);
    }
}

void cal_sum(){
    for(int i = 1; i < n; i++){
        b[i] = a[i] - a[i - 1];
        sum += max(0ll, b[i]);
    }

    cout << get() << "\n";
}

void enter_and_solve_query(){
    int q, l, r, val;

    cin >> q;
    for(int i = 0; i < q; i++){
        cin >> l >> r >> val;
        update(l - 1, r - 1, val);
        cout << get() << "\n";
    }
}

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

    enter_array();
    cal_sum();
    enter_and_solve_query();
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 10;

int n;
long long a[N], b[N];
long long sum;

void enter_array(){
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i];
}

int get(){
    long long x = (sum + a[0]) / 2;
    return(max(x, a[0] + sum - x));
}

void update(int l, int r, int val){
    if (l == 0)
        a[l] += val;

    if (l > 0){
        sum -= max(0ll, b[l]);
        b[l] += val;
        sum += max(0ll, b[l]);
    }

    if (r < n - 1){
        sum -= max(0ll, b[r + 1]);
        b[r + 1] -= val;
        sum += max(0ll, b[r + 1]);
    }
}

void cal_sum(){
    for(int i = 1; i < n; i++){
        b[i] = a[i] - a[i - 1];
        sum += max(0ll, b[i]);
    }

    cout << get() << "\n";
}

void enter_and_solve_query(){
    int q, l, r, val;

    cin >> q;
    for(int i = 0; i < q; i++){
        cin >> l >> r >> val;
        update(l - 1, r - 1, val);
        cout << get() << "\n";
    }
}

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

    enter_array();
    cal_sum();
    enter_and_solve_query();
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 10;

int n;
long long a[N], b[N];
long long sum;

void enter_array(){
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i];
}

int get(){
    return((sum + a[0] + 1) / 2);
}

void update(int l, int r, int val){
    if (l == 0)
        a[l] += val;

    if (l > 0){
        sum -= max(0ll, b[l]);
        b[l] += val;
        sum += max(0ll, b[l]);
    }

    if (r < n - 1){
        sum -= max(0ll, b[r + 1]);
        b[r + 1] -= val;
        sum += max(0ll, b[r + 1]);
    }
}

void cal_sum(){
    for(int i = 1; i < n; i++){
        b[i] = a[i] - a[i - 1];
        sum += max(0ll, b[i]);
    }

    cout << get() << "\n";
}

void enter_and_solve_query(){
    int q, l, r, val;

    cin >> q;
    for(int i = 0; i < q; i++){
        cin >> l >> r >> val;
        update(l - 1, r - 1, val);
        cout << get() << "\n";
    }
}

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

    enter_array();
    cal_sum();
    enter_and_solve_query();
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e5+7;
const ll mod=1e9+7;
ll a[maxn],c[maxn];
int main (){
    int n;
    //printf("%d\n",(-5)/2);
    scanf("%d",&n);
    ll z=0,f=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        c[i]=a[i]-a[i-1];
        if(i>2)
        {
            if(c[i]>0)
            {
                z+=c[i];
            }
            else
            {
                f+=c[i];
            }
        }
    }
    printf("%lld\n",(z+a[1]+1)/2);
    int q;
    cin>>q;
    while(q--)
    {
        int l,r;
        ll x;
        scanf("%d %d %lld",&l,&r,&x);
        if(l==1)
        {
            a[1]+=x;
        }
        else
        {
            if(c[l]>0) z-=c[l];
            else f-=c[l];
            c[l]+=x;
            if(c[l]>0) z+=c[l];
            else f-=c[l];
        }
        if(r==n)
        {
            if(l!=r)
            a[n]+=x;
        }
        else
        {
            if(c[r+1]>0) z-=c[r+1];
            else f-=c[r+1];
            c[r+1]-=x;
            if(c[r+1]>0) z+=c[r+1];
            else f+=c[r+1];
        }
        if(z+a[1]<0)
            printf("%lld\n",(z+a[1])/2);
        else printf("%lld\n",(z+a[1]+1)/2);
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e5+7;
const ll mod=1e9+7;
ll a[maxn],c[maxn];
int main (){
    int n;
    //printf("%d\n",(-5)/2);
    scanf("%d",&n);
    ll z=0,f=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        c[i]=a[i]-a[i-1];
        if(i>2)
        {
            if(c[i]>0)
            {
                z+=c[i];
            }
            else
            {
                f+=c[i];
            }
        }
    }
    if(z+a[1]<0)
            printf("%lld\n",(z+a[1])/2);
    else printf("%lld\n",(z+a[1]+1)/2);
    int q;
    cin>>q;
    while(q--)
    {
        int l,r;
        ll x;
        scanf("%d %d %lld",&l,&r,&x);
        if(l==1)
        {
            a[1]+=x;
        }
        else
        {
            if(c[l]>0) z-=c[l];
            else f-=c[l];
            c[l]+=x;
            if(c[l]>0) z+=c[l];
            else f-=c[l];
        }
        if(r==n)
        {
            if(l!=r)
            a[n]+=x;
        }
        else
        {
            if(c[r+1]>0) z-=c[r+1];
            else f-=c[r+1];
            c[r+1]-=x;
            if(c[r+1]>0) z+=c[r+1];
            else f+=c[r+1];
        }
        if(z+a[1]<0)
            printf("%lld\n",(z+a[1])/2);
        else printf("%lld\n",(z+a[1]+1)/2);
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e5+7;
const ll mod=1e9+7;
ll a[maxn],c[maxn];
int main (){
    int n;
    //printf("%d\n",(-5)/2);
    scanf("%d",&n);
    ll z=0,f=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        c[i]=a[i]-a[i-1];
        if(i>2)
        {
            if(c[i]>0)
            {
                z+=c[i];
            }
            else
            {
                f+=c[i];
            }
        }
    }
    printf("%lld\n",max((z+a[1])/2,z+a[1]-(z+a[1])/2));
    int q;
    cin>>q;
    while(q--)
    {
        int l,r;
        ll x;
        scanf("%d %d %lld",&l,&r,&x);
        if(l==1)
        {
            a[1]+=x;
        }
        else
        {
            if(c[l]>0) z-=c[l];
            else f-=c[l];
            c[l]+=x;
            if(c[l]>0) z+=c[l];
            else f-=c[l];
        }
        if(r==n)
        {
            if(l!=r)
            a[n]+=x;
        }
        else
        {
            if(c[r+1]>0) z-=c[r+1];
            else f-=c[r+1];
            c[r+1]-=x;
            if(c[r+1]>0) z+=c[r+1];
            else f+=c[r+1];
        }
        printf("%lld\n",max((z+a[1])/2,z+a[1]-(z+a[1])/2));
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e5+7;
const ll mod=1e9+7;
ll a[maxn],c[maxn];
int main (){
    int n;
    scanf("%d",&n);
    ll z=0,f=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        c[i]=a[i]-a[i-1];
        if(i>2)
        {
            if(c[i]>0)
            {
                z+=c[i];
            }
            else
            {
                f+=c[i];
            }
        }
    }
    printf("%lld\n",(z+a[1]+1)/2);
    int q;
    cin>>q;
    while(q--)
    {
        int l,r;
        ll x;
        scanf("%d %d %lld",&l,&r,&x);
        if(l==1)
        {
            a[1]+=x;
        }
        else
        {
            if(c[l]>0) z-=c[l];
            else f-=c[l];
            c[l]+=x;
            if(c[l]>0) z+=c[l];
            else f-=c[l];
        }
        if(r==n)
        {
            a[n]+=x;
        }
        else
        {
            if(c[r+1]>0) z-=c[r+1];
            else f-=c[r+1];
            c[r+1]-=x;
            if(c[r+1]>0) z+=c[r+1];
            else f+=c[r+1];
        }
        printf("%lld\n",(z+a[1]+1)/2);
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e5+7;
const ll mod=1e9+7;
ll a[maxn],c[maxn];
int main (){
    int n;
    //printf("%d\n",(-5)/2);
    scanf("%d",&n);
    ll z=0,f=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        c[i]=a[i]-a[i-1];
        if(i>=2)
        {
            if(c[i]>0)
            {
                z+=c[i];
            }
            else
            {
                f+=c[i];
            }
        }
    }
    printf("%lld\n",max((z+a[1])/2,z+a[1]-(z+a[1])/2));
    int q;
    cin>>q;
    while(q--)
    {
        int l,r;
        ll x;
        scanf("%d %d %lld",&l,&r,&x);
        if(l==1)
        {
            a[1]+=x;
        }
        else
        {
            if(c[l]>0) z-=c[l];
            else f-=c[l];
            c[l]+=x;
            if(c[l]>0) z+=c[l];
            else f-=c[l];
        }
        if(r==n)
        {
            if(l!=r)
                a[n]+=x;
        }
        else
        {
            if(c[r+1]>0) z-=c[r+1];
            else f-=c[r+1];
            c[r+1]-=x;
            if(c[r+1]>0) z+=c[r+1];
            else f+=c[r+1];
        }
        printf("%lld\n",max((z+a[1])/2,z+a[1]-(z+a[1])/2));
    }

    return 0;
}


// Problem: D. Three Sequences
// Date:	September 12 2020
// Author:	OBJECT.907X
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(I,B,E)  for(int I=B;I<(E);++I)
#define loop(I,B,E) for(int I=B;I<=(E);++I)
template<class T>void cmax (T& _,T __){if(_<__) _=__;}
template<class T>void cmin (T& _,T __){if(_>__) _=__;}
namespace FastIO{
	char ibf[1<<20],d[42],*ip=ibf+1,*t=ibf+1,obf[1<<17],*op=obf;
	#define INPUT t=ibf+fread(ibf,1,1<<20,stdin),ip=ibf
	#ifndef ONLINE_JUDGE
		#define FLUSH flush();
	#else
		#define FLUSH if((op-obf)>=(1<<17)-70){ flush();}
	#endif
	bool read(char* s){ char* tmp=s;
		while(t!=ibf){ while(ip!=t && *ip<=' ') ip++;
			if(ip!=t) break; else INPUT; }
		while(t!=ibf){ for(;ip<t && *ip>' ';ip++) *s++=*ip;
			if(ip!=t) break; else INPUT; }
		*s='\0'; return s!=tmp; }
	template<class T>bool read(T& x){
		if(!read(d)){return false;} x=0;
		for(char* p=d+(*d=='-');*p;) x=x*10+((*p++)^48);
		if(*d=='-'){x=-x;} return true; }
	inline void flush(){if(op!=obf){
		fwrite(obf,1,op-obf,stdout);op=obf;}}
	template<class T>void print(T x){
		if(x<0){*op++='-';x=-x;} if(x==0){*op++='0';return;}
		char* p=d; for(;x;x/=10) *p++=x%10+'0';
		while(p!=d){*op++=*--p;} FLUSH}
	inline void print(char* s){while(*s!='\0'){*op++=*s++;FLUSH};}
	inline void print(char ch){*op++=ch;FLUSH}
	inline void print(const char* s)
	{for(int i=0;s[i];i++){FLUSH *op++=s[i];}}
	template<class T,class... Args>inline
	bool read(T& x,Args&...r){return read(x)&&read(r...);}
	template<class T,class... Args>inline
	void print(T x,Args...r){print(x),print(r...);}
	template<class... Args>inline
	void println(Args...r){print(r...);print('\n');}
}using namespace FastIO;
const int maxn=1e5+10,INF=0x3f3f3f3f;
const LL LINF=(LL)INF<<32|INF,mod=1e9+7;
int main()
{
	#ifndef ONLINE_JUDGE
	   	freopen("X:/WorkSpace/data.in","r",stdin);
		// freopen("X:/WorkSpace/data.out","w",stdout);
	#endif
	int n,q,l,r,x;
	LL ans=0;
	read(n);
	vector<LL> a(n+1,0);
	loop(i,1,n) read(a[i]);
	for(int i=n;i>1;i--) a[i]-=a[i-1],ans+=max(0LL,a[i]);
	println((LL)ceil(0.5*(ans+a[1])));
	read(q);
	function<void(int,int)> change=[&](int p,int delta){
		if(p>n) return;
		if(p==1) return a[1]+=delta,void();
		ans-=max(0LL,a[p]);
		ans+=max(0LL,a[p]+=delta);
	};
	while(q--)
	{
		read(l,r,x);
		change(l,x);
		change(r+1,-x);
		println((LL)ceil(0.5*(ans+a[1])));
	}
	#ifndef ONLINE_JUDGE
	   	println(" # local execute time:",clock(),"ms");
	#endif
	flush();
	return 0;
}


// Problem: D. Three Sequences
// Date:	September 12 2020
// Author:	OBJECT.907X
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(I,B,E)  for(int I=B;I<(E);++I)
#define loop(I,B,E) for(int I=B;I<=(E);++I)
template<class T>void cmax (T& _,T __){if(_<__) _=__;}
template<class T>void cmin (T& _,T __){if(_>__) _=__;}
namespace FastIO{
	char ibf[1<<20],d[42],*ip=ibf+1,*t=ibf+1,obf[1<<17],*op=obf;
	#define INPUT t=ibf+fread(ibf,1,1<<20,stdin),ip=ibf
	#ifndef ONLINE_JUDGE
		#define FLUSH flush();
	#else
		#define FLUSH if((op-obf)>=(1<<17)-70){ flush();}
	#endif
	bool read(char* s){ char* tmp=s;
		while(t!=ibf){ while(ip!=t && *ip<=' ') ip++;
			if(ip!=t) break; else INPUT; }
		while(t!=ibf){ for(;ip<t && *ip>' ';ip++) *s++=*ip;
			if(ip!=t) break; else INPUT; }
		*s='\0'; return s!=tmp; }
	template<class T>bool read(T& x){
		if(!read(d)){return false;} x=0;
		for(char* p=d+(*d=='-');*p;) x=x*10+((*p++)^48);
		if(*d=='-'){x=-x;} return true; }
	inline void flush(){if(op!=obf){
		fwrite(obf,1,op-obf,stdout);op=obf;}}
	template<class T>void print(T x){
		if(x<0){*op++='-';x=-x;} if(x==0){*op++='0';return;}
		char* p=d; for(;x;x/=10) *p++=x%10+'0';
		while(p!=d){*op++=*--p;} FLUSH}
	inline void print(char* s){while(*s!='\0'){*op++=*s++;FLUSH};}
	inline void print(char ch){*op++=ch;FLUSH}
	inline void print(const char* s)
	{for(int i=0;s[i];i++){FLUSH *op++=s[i];}}
	template<class T,class... Args>inline
	bool read(T& x,Args&...r){return read(x)&&read(r...);}
	template<class T,class... Args>inline
	void print(T x,Args...r){print(x),print(r...);}
	template<class... Args>inline
	void println(Args...r){print(r...);print('\n');}
}using namespace FastIO;
const int maxn=1e5+10,INF=0x3f3f3f3f;
const LL LINF=(LL)INF<<32|INF,mod=1e9+7;
int a[maxn];
struct SegmentTree
{
	LL sum[maxn<<2],f;
	#define left (p<<1)
	#define right (p<<1|1)
	void pushUp(int p)
	{
		sum[p]=max(0LL,sum[left])+max(0LL,sum[right]);
	}
	void build(int p,int L,int R)
	{
		if(L==R)
		{
			sum[p]=L==1?0:a[L]-a[L-1];
			return;
		}
		int mid=(L+R)>>1;
		build(left,L,mid);
		build(right,mid+1,R);
		pushUp(p);
	}
	void change(int p,int L,int R,int pos,int delta)
	{
		if(L==R)
		{
			sum[p]+=delta;
			return;
		}
		int mid=(L+R)>>1;
		if(pos<=mid) change(left,L,mid,pos,delta);
		else change(right,mid+1,R,pos,delta);
		pushUp(p);
	}
	LL query(){
		LL x=sum[1]+f;
		if(x) x+=x/abs(x);
		return x/2;
	}
}seg;
int main()
{
	#ifndef ONLINE_JUDGE
	   	freopen("X:/WorkSpace/data.in","r",stdin);
		// freopen("X:/WorkSpace/data.out","w",stdout);
	#endif
	int n,q,l,r,x;
	read(n);
	loop(i,1,n) read(a[i]);
	seg.build(1,1,n);
	seg.f=a[1];
	println(seg.query());
	read(q);
	while(q--)
	{
		read(l,r,x);
		if(l==1) seg.f+=x;
		seg.change(1,1,n,l,x);
		if(r!=n) seg.change(1,1,n,r+1,-x);
		println(seg.query());
	}
	#ifndef ONLINE_JUDGE
	   	println(" # local execute time:",clock(),"ms");
	#endif
	flush();
	return 0;
}


// Problem: D. Three Sequences
// Date:	September 12 2020
// Author:	OBJECT.907X
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(I,B,E)  for(int I=B;I<(E);++I)
#define loop(I,B,E) for(int I=B;I<=(E);++I)
template<class T>void cmax (T& _,T __){if(_<__) _=__;}
template<class T>void cmin (T& _,T __){if(_>__) _=__;}
namespace FastIO{
	char ibf[1<<20],d[42],*ip=ibf+1,*t=ibf+1,obf[1<<17],*op=obf;
	#define INPUT t=ibf+fread(ibf,1,1<<20,stdin),ip=ibf
	#ifndef ONLINE_JUDGE
		#define FLUSH flush();
	#else
		#define FLUSH if((op-obf)>=(1<<17)-70){ flush();}
	#endif
	bool read(char* s){ char* tmp=s;
		while(t!=ibf){ while(ip!=t && *ip<=' ') ip++;
			if(ip!=t) break; else INPUT; }
		while(t!=ibf){ for(;ip<t && *ip>' ';ip++) *s++=*ip;
			if(ip!=t) break; else INPUT; }
		*s='\0'; return s!=tmp; }
	template<class T>bool read(T& x){
		if(!read(d)){return false;} x=0;
		for(char* p=d+(*d=='-');*p;) x=x*10+((*p++)^48);
		if(*d=='-'){x=-x;} return true; }
	inline void flush(){if(op!=obf){
		fwrite(obf,1,op-obf,stdout);op=obf;}}
	template<class T>void print(T x){
		if(x<0){*op++='-';x=-x;} if(x==0){*op++='0';return;}
		char* p=d; for(;x;x/=10) *p++=x%10+'0';
		while(p!=d){*op++=*--p;} FLUSH}
	inline void print(char* s){while(*s!='\0'){*op++=*s++;FLUSH};}
	inline void print(char ch){*op++=ch;FLUSH}
	inline void print(const char* s)
	{for(int i=0;s[i];i++){FLUSH *op++=s[i];}}
	template<class T,class... Args>inline
	bool read(T& x,Args&...r){return read(x)&&read(r...);}
	template<class T,class... Args>inline
	void print(T x,Args...r){print(x),print(r...);}
	template<class... Args>inline
	void println(Args...r){print(r...);print('\n');}
}using namespace FastIO;
const int maxn=1e5+10,INF=0x3f3f3f3f;
const LL LINF=(LL)INF<<32|INF,mod=1e9+7;
int a[maxn];
struct SegmentTree
{
	LL sum[maxn<<2],f;
	#define left (p<<1)
	#define right (p<<1|1)
	void pushUp(int p)
	{
		sum[p]=max(0LL,sum[left])+max(0LL,sum[right]);
	}
	void build(int p,int L,int R)
	{
		if(L==R)
		{
			sum[p]=L==1?0:a[L]-a[L-1];
			return;
		}
		int mid=(L+R)>>1;
		build(left,L,mid);
		build(right,mid+1,R);
		pushUp(p);
	}
	void change(int p,int L,int R,int pos,int delta)
	{
		if(pos>R) return;
		if(L==R)
		{
			sum[p]+=delta;
			return;
		}
		int mid=(L+R)>>1;
		if(pos<=mid) change(left,L,mid,pos,delta);
		else change(right,mid+1,R,pos,delta);
		pushUp(p);
	}
	LL query(){
		LL x=sum[1]+f;
		if(x%2) x++;
		return x/2;
	}
}seg;
int main()
{
	#ifndef ONLINE_JUDGE
	   	freopen("X:/WorkSpace/data.in","r",stdin);
		// freopen("X:/WorkSpace/data.out","w",stdout);
	#endif
	int n,q,l,r,x;
	read(n);
	loop(i,1,n) read(a[i]);
	seg.build(1,1,n);
	seg.f=a[1];
	println(seg.query());
	read(q);
	while(q--)
	{
		read(l,r,x);
		if(l==1) seg.f+=x;
		seg.change(1,1,n,max(l,2),x);
		if(r!=n) seg.change(1,1,n,r+1,-x);
		println(seg.query());
	}
	#ifndef ONLINE_JUDGE
	   	println(" # local execute time:",clock(),"ms");
	#endif
	flush();
	return 0;
}


// Problem: D. Three Sequences
// Date:	September 12 2020
// Author:	OBJECT.907X
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(I,B,E)  for(int I=B;I<(E);++I)
#define loop(I,B,E) for(int I=B;I<=(E);++I)
template<class T>void cmax (T& _,T __){if(_<__) _=__;}
template<class T>void cmin (T& _,T __){if(_>__) _=__;}
namespace FastIO{
	char ibf[1<<20],d[42],*ip=ibf+1,*t=ibf+1,obf[1<<17],*op=obf;
	#define INPUT t=ibf+fread(ibf,1,1<<20,stdin),ip=ibf
	#ifndef ONLINE_JUDGE
		#define FLUSH flush();
	#else
		#define FLUSH if((op-obf)>=(1<<17)-70){ flush();}
	#endif
	bool read(char* s){ char* tmp=s;
		while(t!=ibf){ while(ip!=t && *ip<=' ') ip++;
			if(ip!=t) break; else INPUT; }
		while(t!=ibf){ for(;ip<t && *ip>' ';ip++) *s++=*ip;
			if(ip!=t) break; else INPUT; }
		*s='\0'; return s!=tmp; }
	template<class T>bool read(T& x){
		if(!read(d)){return false;} x=0;
		for(char* p=d+(*d=='-');*p;) x=x*10+((*p++)^48);
		if(*d=='-'){x=-x;} return true; }
	inline void flush(){if(op!=obf){
		fwrite(obf,1,op-obf,stdout);op=obf;}}
	template<class T>void print(T x){
		if(x<0){*op++='-';x=-x;} if(x==0){*op++='0';return;}
		char* p=d; for(;x;x/=10) *p++=x%10+'0';
		while(p!=d){*op++=*--p;} FLUSH}
	inline void print(char* s){while(*s!='\0'){*op++=*s++;FLUSH};}
	inline void print(char ch){*op++=ch;FLUSH}
	inline void print(const char* s)
	{for(int i=0;s[i];i++){FLUSH *op++=s[i];}}
	template<class T,class... Args>inline
	bool read(T& x,Args&...r){return read(x)&&read(r...);}
	template<class T,class... Args>inline
	void print(T x,Args...r){print(x),print(r...);}
	template<class... Args>inline
	void println(Args...r){print(r...);print('\n');}
}using namespace FastIO;
const int maxn=1e5+10,INF=0x3f3f3f3f;
const LL LINF=(LL)INF<<32|INF,mod=1e9+7;
int a[maxn];
struct SegmentTree
{
	LL sum[maxn<<2],f;
	#define left (p<<1)
	#define right (p<<1|1)
	void pushUp(int p)
	{
		sum[p]=max(0LL,sum[left])+max(0LL,sum[right]);
	}
	void build(int p,int L,int R)
	{
		if(L==R)
		{
			sum[p]=L==1?0:a[L]-a[L-1];
			return;
		}
		int mid=(L+R)>>1;
		build(left,L,mid);
		build(right,mid+1,R);
		pushUp(p);
	}
	void change(int p,int L,int R,int pos,int delta)
	{
		if(L==R)
		{
			sum[p]+=delta;
			return;
		}
		int mid=(L+R)>>1;
		if(pos<=mid) change(left,L,mid,pos,delta);
		else change(right,mid+1,R,pos,delta);
		pushUp(p);
	}
	LL query(){return (sum[1]+f+1)/2;}
}seg;
int main()
{
	#ifndef ONLINE_JUDGE
	   	freopen("X:/WorkSpace/data.in","r",stdin);
		// freopen("X:/WorkSpace/data.out","w",stdout);
	#endif
	int n,q,l,r,x;
	read(n);
	loop(i,1,n) read(a[i]);
	seg.build(1,1,n);
	seg.f=a[1];
	println(seg.query());
	read(q);
	while(q--)
	{
		read(l,r,x);
		if(l==1) seg.f+=x;
		seg.change(1,1,n,l,x);
		if(r!=n) seg.change(1,1,n,r+1,-x);
		println(seg.query());
	}
	#ifndef ONLINE_JUDGE
	   	println(" # local execute time:",clock(),"ms");
	#endif
	flush();
	return 0;
}


// Problem: D. Three Sequences
// Date:	September 12 2020
// Author:	OBJECT.907X
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(I,B,E)  for(int I=B;I<(E);++I)
#define loop(I,B,E) for(int I=B;I<=(E);++I)
template<class T>void cmax (T& _,T __){if(_<__) _=__;}
template<class T>void cmin (T& _,T __){if(_>__) _=__;}
namespace FastIO{
	char ibf[1<<20],d[42],*ip=ibf+1,*t=ibf+1,obf[1<<17],*op=obf;
	#define INPUT t=ibf+fread(ibf,1,1<<20,stdin),ip=ibf
	#ifndef ONLINE_JUDGE
		#define FLUSH flush();
	#else
		#define FLUSH if((op-obf)>=(1<<17)-70){ flush();}
	#endif
	bool read(char* s){ char* tmp=s;
		while(t!=ibf){ while(ip!=t && *ip<=' ') ip++;
			if(ip!=t) break; else INPUT; }
		while(t!=ibf){ for(;ip<t && *ip>' ';ip++) *s++=*ip;
			if(ip!=t) break; else INPUT; }
		*s='\0'; return s!=tmp; }
	template<class T>bool read(T& x){
		if(!read(d)){return false;} x=0;
		for(char* p=d+(*d=='-');*p;) x=x*10+((*p++)^48);
		if(*d=='-'){x=-x;} return true; }
	inline void flush(){if(op!=obf){
		fwrite(obf,1,op-obf,stdout);op=obf;}}
	template<class T>void print(T x){
		if(x<0){*op++='-';x=-x;} if(x==0){*op++='0';return;}
		char* p=d; for(;x;x/=10) *p++=x%10+'0';
		while(p!=d){*op++=*--p;} FLUSH}
	inline void print(char* s){while(*s!='\0'){*op++=*s++;FLUSH};}
	inline void print(char ch){*op++=ch;FLUSH}
	inline void print(const char* s)
	{for(int i=0;s[i];i++){FLUSH *op++=s[i];}}
	template<class T,class... Args>inline
	bool read(T& x,Args&...r){return read(x)&&read(r...);}
	template<class T,class... Args>inline
	void print(T x,Args...r){print(x),print(r...);}
	template<class... Args>inline
	void println(Args...r){print(r...);print('\n');}
}using namespace FastIO;
const int maxn=1e5+10,INF=0x3f3f3f3f;
const LL LINF=(LL)INF<<32|INF,mod=1e9+7;
int a[maxn];
struct SegmentTree
{
	LL sum[maxn<<2],f;
	#define left (p<<1)
	#define right (p<<1|1)
	void pushUp(int p)
	{
		sum[p]=max(0LL,sum[left])+max(0LL,sum[right]);
	}
	void build(int p,int L,int R)
	{
		if(L==R)
		{
			sum[p]=L==1?0:a[L]-a[L-1];
			return;
		}
		int mid=(L+R)>>1;
		build(left,L,mid);
		build(right,mid+1,R);
		pushUp(p);
	}
	void change(int p,int L,int R,int pos,int delta)
	{
		if(L==R)
		{
			sum[p]+=delta;
			return;
		}
		int mid=(L+R)>>1;
		if(pos<=mid) change(left,L,mid,pos,delta);
		else change(right,mid+1,R,pos,delta);
		pushUp(p);
	}
	LL query(){
		LL x=sum[1]+f;
		if(x%2!=0) x++;
		return x/2;
	}
}seg;
int main()
{
	#ifndef ONLINE_JUDGE
	   	freopen("X:/WorkSpace/data.in","r",stdin);
		// freopen("X:/WorkSpace/data.out","w",stdout);
	#endif
	int n,q,l,r,x;
	read(n);
	loop(i,1,n) read(a[i]);
	seg.build(1,1,n);
	seg.f=a[1];
	println(seg.query());
	read(q);
	while(q--)
	{
		read(l,r,x);
		if(l==1 && r!=1) seg.f+=x;
		seg.change(1,1,n,l,x);
		if(r!=n) seg.change(1,1,n,r+1,-x);
		println(seg.query());
	}
	#ifndef ONLINE_JUDGE
	   	println(" # local execute time:",clock(),"ms");
	#endif
	flush();
	return 0;
}


// Problem: D. Three Sequences
// Date:	September 12 2020
// Author:	OBJECT.907X
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(I,B,E)  for(int I=B;I<(E);++I)
#define loop(I,B,E) for(int I=B;I<=(E);++I)
template<class T>void cmax (T& _,T __){if(_<__) _=__;}
template<class T>void cmin (T& _,T __){if(_>__) _=__;}
namespace FastIO{
	char ibf[1<<20],d[42],*ip=ibf+1,*t=ibf+1,obf[1<<17],*op=obf;
	#define INPUT t=ibf+fread(ibf,1,1<<20,stdin),ip=ibf
	#ifndef ONLINE_JUDGE
		#define FLUSH flush();
	#else
		#define FLUSH if((op-obf)>=(1<<17)-70){ flush();}
	#endif
	bool read(char* s){ char* tmp=s;
		while(t!=ibf){ while(ip!=t && *ip<=' ') ip++;
			if(ip!=t) break; else INPUT; }
		while(t!=ibf){ for(;ip<t && *ip>' ';ip++) *s++=*ip;
			if(ip!=t) break; else INPUT; }
		*s='\0'; return s!=tmp; }
	template<class T>bool read(T& x){
		if(!read(d)){return false;} x=0;
		for(char* p=d+(*d=='-');*p;) x=x*10+((*p++)^48);
		if(*d=='-'){x=-x;} return true; }
	inline void flush(){if(op!=obf){
		fwrite(obf,1,op-obf,stdout);op=obf;}}
	template<class T>void print(T x){
		if(x<0){*op++='-';x=-x;} if(x==0){*op++='0';return;}
		char* p=d; for(;x;x/=10) *p++=x%10+'0';
		while(p!=d){*op++=*--p;} FLUSH}
	inline void print(char* s){while(*s!='\0'){*op++=*s++;FLUSH};}
	inline void print(char ch){*op++=ch;FLUSH}
	inline void print(const char* s)
	{for(int i=0;s[i];i++){FLUSH *op++=s[i];}}
	template<class T,class... Args>inline
	bool read(T& x,Args&...r){return read(x)&&read(r...);}
	template<class T,class... Args>inline
	void print(T x,Args...r){print(x),print(r...);}
	template<class... Args>inline
	void println(Args...r){print(r...);print('\n');}
}using namespace FastIO;
const int maxn=1e5+10,INF=0x3f3f3f3f;
const LL LINF=(LL)INF<<32|INF,mod=1e9+7;
int a[maxn];
struct SegmentTree
{
	LL sum[maxn<<2],f;
	#define left (p<<1)
	#define right (p<<1|1)
	void pushUp(int p)
	{
		sum[p]=max(0LL,sum[left])+max(0LL,sum[right]);
	}
	void build(int p,int L,int R)
	{
		if(L==R)
		{
			sum[p]=L==1?0:a[L]-a[L-1];
			return;
		}
		int mid=(L+R)>>1;
		build(left,L,mid);
		build(right,mid+1,R);
		pushUp(p);
	}
	void change(int p,int L,int R,int pos,int delta)
	{
		if(L==R)
		{
			sum[p]+=delta;
			return;
		}
		int mid=(L+R)>>1;
		if(pos<=mid) change(left,L,mid,pos,delta);
		else change(right,mid+1,R,pos,delta);
		pushUp(p);
	}
	LL query(){return (sum[1]+f+1)/2;}
}seg;
int main()
{
	#ifndef ONLINE_JUDGE
	   	freopen("X:/WorkSpace/data.in","r",stdin);
		// freopen("X:/WorkSpace/data.out","w",stdout);
	#endif
	int n,q,l,r,x;
	read(n);
	loop(i,1,n) read(a[i]);
	seg.build(1,1,n);
	seg.f=a[1];
	println(seg.query());
	read(q);
	while(q--)
	{
		read(l,r,x);
		if(l==1) seg.f+=x;
		seg.change(1,1,n,l,x);
		if(r!=n) seg.change(1,1,n,r,-x);
		println(seg.query());
	}
	#ifndef ONLINE_JUDGE
	   	println(" # local execute time:",clock(),"ms");
	#endif
	flush();
	return 0;
}


//
// 18C.cpp
//
// Siwakorn Srisakaokul - ping128
// Written on Friday,  3 January 2014.
//

#include <cstdio>
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <algorithm>
#include <map>
#include <ctype.h>
#include <string.h>

#include <assert.h>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<PII, int> PII2;

int N;
int in[100005];

int main() {
    scanf("%d", &N);
    for (int i = 1; i <= N; i++) {
        scanf("%d", &in[i]);
        in[i] += in[i - 1];
    }

    int res = 0;
    for (int i = 1; i < N; i++) {
        if (in[i] == in[N] - in[i]) res++;
    }
    printf("%d\n", res);
    return 0;
}


/////////////////////////////////////////////////   IN THE NAME OF GO
#include <bits/stdc++.h>

using namespace std;

//#pragma comment(linker, "/STACK:1024000000,1024000000")

#define     For(i,a,b)        for (int i=a; i<b; i++)
#define     Rep(i,a)          for (int i=0; i<a; i++)
#define     ALL(v)            (v).begin(),(v).end()
#define     Set(a,x)          memset((a),(x),sizeof(a))
#define     EXIST(a,b)        find(ALL(a),(b))!=(a).end()
#define     Sort(x)           sort(ALL(x))
#define     UNIQUE(v)         Sort(v); (v).resize(unique(ALL(v)) - (v).begin())
#define     SF                scanf
#define     PF                printf
#define     timestamp(x)      printf("Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define     INF               1e11
#define     pii               pair < int , int >
#define     MP                make_pair
#define     MOD               1000000007
#define     EPS               1e-11
#define     ll                long long
#define     MAXN              100000+10
#define     Dbug              cout<<""
#define     PI                3.1415926535897932384626433
//int month[]={0,31,28,31,30,31,30,31,31,30,31,30,31};

ll n ;
ll arr[MAXN] , suml[MAXN] , sumr[MAXN] ;

int main()
{
    ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    freopen ( "input.txt" , "r" , stdin ) ;
    //freopen ( "input.txt" , "w" , stdout ) ;
#endif
    cin >> n ;
    Rep ( i , n ) cin >> arr[i] ;
    suml[0] = arr[0] ;
    For ( i , 1 , n ) suml[i] = ( suml[i-1] + arr[i] );
    sumr[n-1] = arr[n-1] ;;
    for ( int i = n - 2 ; i >= 0 ; i-- ) sumr[i] = ( sumr[i+1] + arr[i] ) ;
    ll ans = 0 ;
    Rep ( i , n - 1){
        if ( suml[i] == sumr[i+1] ) ans++ ;
    }
    cout << ans << endl ;
    return 0;
}


/////////////////////////////////////////////////   IN THE NAME OF GO
#include <bits/stdc++.h>

using namespace std;

//#pragma comment(linker, "/STACK:1024000000,1024000000")

#define     For(i,a,b)        for (int i=a; i<b; i++)
#define     Rep(i,a)          for (int i=0; i<a; i++)
#define     ALL(v)            (v).begin(),(v).end()
#define     Set(a,x)          memset((a),(x),sizeof(a))
#define     EXIST(a,b)        find(ALL(a),(b))!=(a).end()
#define     Sort(x)           sort(ALL(x))
#define     UNIQUE(v)         Sort(v); (v).resize(unique(ALL(v)) - (v).begin())
#define     SF                scanf
#define     PF                printf
#define     timestamp(x)      printf("Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define     INF               1e11
#define     pii               pair < int , int >
#define     MP                make_pair
#define     MOD               1000000007
#define     EPS               1e-11
#define     ll                long long
#define     MAXN              100000+10
#define     Dbug              cout<<""
#define     PI                3.1415926535897932384626433
//int month[]={0,31,28,31,30,31,30,31,31,30,31,30,31};

ll n ;
ll arr[MAXN] , suml[MAXN] , sumr[MAXN] ;
bool posr[MAXN] ;

int main()
{
    ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    freopen ( "input.txt" , "r" , stdin ) ;
    //freopen ( "input.txt" , "w" , stdout ) ;
#endif
    cin >> n ;
    Rep ( i , n ) cin >> arr[i] ;
    suml[0] = arr[0] ;
    For ( i , 1 , n ) suml[i] = ( suml[i-1] + arr[i] );
    sumr[n-1] = arr[n-1] ;
    posr[n-1] = arr[n-1] >= 0 ? 1 : 0 ;
    for ( int i = n - 2 ; i >= 0 ; i-- ){
        sumr[i] = ( sumr[i+1] + arr[i] ) ;
        posr[i] = ( posr[i+1] | ( arr[i] >= 0 ? 1 : 0 ) ) ;
    }
    ll ans = 0 , can = 0 ;
    Rep ( i , n - 1){
        if ( arr[i] >= 0 ) can = 1 ;
        if ( suml[i] == sumr[i+1] && can && posr[i+1] ) ans++ ;
    }
    cout << ans << endl ;
    return 0;
}


/////////////////////////////////////////////////   IN THE NAME OF GO
#include <bits/stdc++.h>

using namespace std;

//#pragma comment(linker, "/STACK:1024000000,1024000000")

#define     For(i,a,b)        for (int i=a; i<b; i++)
#define     Rep(i,a)          for (int i=0; i<a; i++)
#define     ALL(v)            (v).begin(),(v).end()
#define     Set(a,x)          memset((a),(x),sizeof(a))
#define     EXIST(a,b)        find(ALL(a),(b))!=(a).end()
#define     Sort(x)           sort(ALL(x))
#define     UNIQUE(v)         Sort(v); (v).resize(unique(ALL(v)) - (v).begin())
#define     SF                scanf
#define     PF                printf
#define     timestamp(x)      printf("Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define     INF               1e11
#define     pii               pair < int , int >
#define     MP                make_pair
#define     MOD               1000000007
#define     EPS               1e-11
#define     ll                long long
#define     MAXN              100000+10
#define     Dbug              cout<<""
#define     PI                3.1415926535897932384626433
//int month[]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int n ;
int arr[MAXN] , suml[MAXN] , sumr[MAXN] ;
bool posr[MAXN] ;

int main()
{
    ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    freopen ( "input.txt" , "r" , stdin ) ;
    //freopen ( "input.txt" , "w" , stdout ) ;
#endif
    cin >> n ;
    Rep ( i , n ) cin >> arr[i] ;
    suml[0] = arr[0] ;
    For ( i , 1 , n ) suml[i] = ( suml[i-1] + arr[i] );
    sumr[n-1] = arr[n-1] ;
    posr[n-1] = arr[n-1] >= 0 ? 1 : 0 ;
    for ( int i = n - 2 ; i >= 0 ; i-- ){
        sumr[i] = ( sumr[i+1] + arr[i] ) ;
        posr[i] = ( posr[i+1] | ( arr[i] >= 0 ? 1 : 0 ) ) ;
    }
    int ans = 0 , can = 0 ;
    Rep ( i , n - 1){
        if ( arr[i] >= 0 ) can = 1 ;
        if ( suml[i] == sumr[i+1] && can && posr[i+1] ) ans++ ;
    }
    cout << ans << endl ;
    return 0;
}


// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n;
	cin >> n;
	vector <int> v(n), sum(n);
	for(int i=0; i < n; i++) {
		cin >> v[i];
		sum[i] = v[i] + (i ? sum[i-1] : 0);
	}
	int ans = 0;
	for(int i=0; i < n-1; i++)
		if(sum[i] == sum[n-1] - sum[i])
			ans++;
	cout << ans << endl;
    //system("pause");
    return 0;
}


// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

template <class Type>
class sgm_tree {
public:
	sgm_tree(int n);
	~sgm_tree();
	void build(vector<Type>& a, int v, int tl, int tr);
	Type sum(int v, int tl, int tr, int l, int r);
	void update(int v, int tl, int tr, int pos, Type new_val);

	vector <Type> tree;
};

template <class Type>
void sgm_tree<Type>::build(vector<Type>& a, int v, int tl, int tr) {
	if(tl == tr)
		tv = a[tl];
	else {
		int tm = (tl + tr) / 2;
		build(a, v*2, tl, tm);
		build(a, v*2+1, tm+1, tr);
		t[v] = t[v*2] + t*v[*2+1];
	}
}

template <class Type>
Type sgm_tree<Type>::sum(int v, int tl, int tr, int l, int r) {
	if(l == tl && r == tr)
		return t[v];
	int tm = (tl + tr) / 2;
	return sum(v*2, tl, tm, l, min(r, tm)) + sum(v*2+1, tm+1, tr, max(l, tm+1), r);
}

template <class Type>
void sgm_tree<Type>::update(int v, int tl, int tr, int pos, Type new_val) {
	if(tl == tr)
		t[v] = new_val;
	else {
		int tm = (tl + tr) / 2;
		if(pos <= tm)
			update(v*2, tl, tm, pos, new_val);
		else
			update(v*2+1, tm+1, tr, pos, new_val);
		t[v] = t[v*2] + t[v*2+1];
	}
}

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n;
	cin >> n;
	vector <int> v(n), sum(n);
	for(int i=0; i < n; i++) {
		cin >> v[i];
		sum[i] = v[i] + (i ? sum[i-1] : 0);
	}
	int ans = 0;
	for(int i=0; i < n-1; i++)
		if(sum[i] == sum[n-1] - sum[i])
			ans++;
	cout << ans << endl;
    //system("pause");
    return 0;
}


// C header files
#include <cmath>
#include <ctime>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <cstdlib>

// C++ header files
#include <map>
#include <set>
#include <deque>
#include <limits>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>

// input / output
#include <fstream>
#include <iomanip>
#include <iostream>

using namespace std;

// C++ types
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short int usi;

// pairs
typedef pair <ll, ll> pll;
typedef pair <int, int> pi;
typedef pair <double, double> pd;

// single vectors
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <double> vd;
typedef vector <string> vs;
typedef vector <long long> vll;

// double vectors
typedef vector < vector <int> > vvi;
typedef vector < vector <bool> > vvb;
typedef vector < vector <char> > vvc;
typedef vector < vector <double> > vvd;
typedef vector < vector <string> > vvs;
typedef vector < pair <int, int> > vpi;
typedef vector < pair <double, double> > vpd;

// macroses
#define ft first
#define sc second
#define len(s) s.length()
#define left(i) 2*(i) + 1
#define right(i) 2*(i) + 2
#define prt(i) ((i)-1) / 2
#define maxV(type) numeric_limits<type>::max()
#define minV(type) numeric_limits<type>::min()
#define sf(a, b, i) for(size_t (i)=(a); (i) < (b); (i)++)

template <class Type>
class sgm_tree {
public:
	sgm_tree(int n);
	~sgm_tree();
	void build(vector<Type>& a, int v, int tl, int tr);
	Type sum(int v, int tl, int tr, int l, int r);
	void update(int v, int tl, int tr, int pos, Type new_val);

	vector <Type> tree;
};

template <class Type>
sgm_tree<Type>::sgm_tree(int n) {
	tree.resize(5*n);
}

template <class Type>
sgm_tree<Type>::~sgm_tree() {
	tree.clear();
}

template <class Type>
void sgm_tree<Type>::build(vector<Type>& a, int v, int tl, int tr) {
	if(tl == tr)
		tree[v] = a[tl];
	else {
		int tm = (tl + tr) / 2;
		build(a, v*2, tl, tm);
		build(a, v*2+1, tm+1, tr);
		tree[v] = tree[v*2] + tree[v*2+1];
	}
}

template <class Type>
Type sgm_tree<Type>::sum(int v, int tl, int tr, int l, int r) {
	if(l > r)
		return 0;
	if(l == tl && r == tr)
		return tree[v];
	int tm = (tl + tr) / 2;
	return sum(v*2, tl, tm, l, min(r, tm)) + sum(v*2+1, tm+1, tr, max(l, tm+1), r);
}

template <class Type>
void sgm_tree<Type>::update(int v, int tl, int tr, int pos, Type new_val) {
	if(tl == tr)
		tree[v] = new_val;
	else {
		int tm = (tl + tr) / 2;
		if(pos <= tm)
			update(v*2, tl, tm, pos, new_val);
		else
			update(v*2+1, tm+1, tr, pos, new_val);
		tree[v] = tree[v*2] + tree[v*2+1];
	}
}

int main()
{
    //freopen("qsort.in", "r", stdin);
    //freopen("qsort.out", "w", stdout);
    int n;
	cin >> n;
	vector <int> v(n+1);
	for(int i=1; i <= n; i++)
		cin >> v[i];
	sgm_tree <int> t(n);
	t.build(v, 1, 1, n);
	int ans = 0;
	for(int i=1; i < n; i++)
		if(t.sum(1, 1, n, 1, i) == t.sum(1, 1, n, 1, n) - t.sum(1, 1, n, 1, i))
			ans++;
	cout << ans << endl;
    //system("pause");
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <queue>
#include <cstdio>

using namespace std;

typedef long long LL;

int n;
int arr[100000];

void solve()
{
    cin >> n;
    int total = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
        total += arr[i];
    }

    int cur = 0, res = 0;
    for (int i = 0; i < n-1; i++)
    {
        cur += arr[i];
        if (2*cur == total)
            res++;
    }

    cout << res << endl;
}

int main()
{
    //freopen("input.txt", "r", stdin);
    solve();
    return 0;
}


#include <iostream>

using namespace std;
typedef long long ll;

int a[1000*100+10];
int main()
{
    ll n=0,total1=0,total2=0,ans=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        total2+=a[i];
    }
    //cout<<total2<<endl;
    for(int i=1;i<n;i++)
    {
        total1+=a[i-1];
        total2-=a[i-1];
        //cout<<total2<<" "<<total1<<endl;
        if(total1==total2)ans++;
    }
    cout<<ans;
    return 0;
}


#include <iostream>

using namespace std;
typedef long long ll;

int a[1000*100+10];
int main()
{
    ll n=0,total1=0,total2=0,ans=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        total2+=a[i];
    }
    for(int i=0;i<n;i++)
    {
        total1+=a[i];
        total2-=a[i];
        if(total1==total2)ans++;
    }
    cout<<ans;
    return 0;
}


#include <string>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <fstream>
#include <cassert>

using namespace std;

                                                                                #define int ll
const bool online_judge =
#ifdef ONLINE_JUDGE
  true
#else
  false
#endif
  ;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

typedef tuple<int,int> int2;
typedef tuple<int,int,int> int3;
typedef tuple<int,int,int,int> int4;

#define all(v)  (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb push_back
#define eb emplace_back
#define SZ(a) ((int)((a).size()))
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,n) for(int i = 1; i <= n; i++)
#define rep3(i,n) for(int i = n-1; i >= 0; i--)
#define tag(i,v) rep(i,SZ(v))
#define _trace(x) #x << " = " << (x)
#define trace(x)  { if(!online_judge) cerr << _trace(x) << endl; }
#define trace2(x,y) { if(!online_judge) cerr << _trace(x) << " " << _trace(y) << endl; }
#define trace3(x,y,z) { if(!online_judge) cerr << _trace(x) << " " << _trace(y) << " " << _trace(z) << endl; }
#define tracev(x) { if(!online_judge) { cerr << #x << " = "; tag(__i, x) { cerr << x[__i] << ","; } cerr << endl; } }
#define fst get<0>
#define snd get<1>
#define thd get<2>
#define divup(x,y) ((x)/(y)+!!((x)%(y)))
#define mp make_tuple
#define range(x,a,b) ((x) >= (a) && (x) <= (b))

const int inf = 1LL << 60;
int toInt(string s) {int res; stringstream ss; ss<<s; ss>>res; return res; }
string toString(int n) { stringstream ss; ss<<n; return ss.str(); }

void run() {

  /* entry point */
  int n;
  vi v;

  cin >> n;
  int sum = 0;

  rep(_,n){
    int tmp;
    cin >> tmp;
    v.pb(tmp);
    sum += tmp;
  }

  int a = 0;
  int ans = 0;

  rep(i,n-1) {
    a += v[i];
    if(a*2 == sum)
      ans++;
  }

  cout << ans << endl;

}

#undef int

int main(int argc, char *argv[]) {

  #if 0
  if(online_judge){
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
  }
  #endif

  run();

  return 0;

}


#include <string>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <fstream>
#include <cassert>

using namespace std;

                                                                                #define int ll
const bool online_judge =
#ifdef ONLINE_JUDGE
  true
#else
  false
#endif
  ;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

typedef tuple<int,int> int2;
typedef tuple<int,int,int> int3;
typedef tuple<int,int,int,int> int4;

#define all(v)  (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb push_back
#define eb emplace_back
#define SZ(a) ((int)((a).size()))
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,n) for(int i = 1; i <= n; i++)
#define rep3(i,n) for(int i = n-1; i >= 0; i--)
#define tag(i,v) rep(i,SZ(v))
#define _trace(x) #x << " = " << (x)
#define trace(x)  { if(!online_judge) cerr << _trace(x) << endl; }
#define trace2(x,y) { if(!online_judge) cerr << _trace(x) << " " << _trace(y) << endl; }
#define trace3(x,y,z) { if(!online_judge) cerr << _trace(x) << " " << _trace(y) << " " << _trace(z) << endl; }
#define tracev(x) { if(!online_judge) { cerr << #x << " = "; tag(__i, x) { cerr << x[__i] << ","; } cerr << endl; } }
#define fst get<0>
#define snd get<1>
#define thd get<2>
#define divup(x,y) ((x)/(y)+!!((x)%(y)))
#define mp make_tuple
#define range(x,a,b) ((x) >= (a) && (x) <= (b))

const int inf = 1LL << 60;
int toInt(string s) {int res; stringstream ss; ss<<s; ss>>res; return res; }
string toString(int n) { stringstream ss; ss<<n; return ss.str(); }

void run() {

  /* entry point */
  int n;
  vi v;

  cin >> n;
  int sum = 0;

  rep(_,n){
    int tmp;
    cin >> tmp;
    v.pb(tmp);
    sum += tmp;
  }

  if(sum % 2 == 1){
    cout << 0 << endl;
    return;
  }

  sum /= 2;

  int a = v[0];
  int ans = 0;
  if(a == sum)
    ans++;

  for(int i = 1; i < n-1; i++) {
    a += v[i];
    if(a == sum)
      ans++;
  }

  cout << ans << endl;

}

#undef int

int main(int argc, char *argv[]) {

  #if 0
  if(online_judge){
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
  }
  #endif

  run();

  return 0;

}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <stdexcept>
#include <functional>
#include <math.h>

#pragma comment(linker, "/STACK:133217728")

using namespace std;

int main() {

    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
	int n;
	int s = 0;
	cin >> n;
	int x[100100];
	for(int i=0; i<n; i++) {
		cin >> x[i];
		s += x[i];
	}
	int ans = 0;
	int s2 = 0;
	for(int i=0; i<n-1; i++) {
		s2 += x[i];
		s -= x[i];

		ans += s2 == s;
	}

	cout << ans << endl;
    return 0;
}


#include<iostream>
using namespace std;
const int MAXN=100007;
int a[MAXN],dp[MAXN];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        dp[i]=dp[i-1]+a[i];
    }
    int ans=0;
    for(int i=1;i<n;i++)
    {
        if(dp[i]==dp[n]-dp[i])
        {
            ans++;
        }
    }
    cout<<ans<<endl;
}


#include <stdio.h>

#define MAX 100000

int main () {
    long long int sum = 0, partial = 0, possibilities = 0;
    int n, i;
    int squares[MAX + 1];

    scanf ("%d", &n);

    for (i = 0; i  < n; i++) {
        scanf ("%d", &squares[i]);
        sum += squares[i];
    }

    for (i = 0; i < n - 1; i++) {
        partial += squares[i];
        sum -= squares[i];
        if (sum == partial) {
            //printf("%d)
            possibilities++;
        }
    }

    printf("%lld\n", possibilities);
    return 0;
}


#include <stdio.h>

#define MAX 100000

int main () {
    long long int sum = 0, partial = 0, possibilities = 0;
    int n, i;
    int squares[MAX + 1];

    scanf ("%d", &n);

    for (i = 0; i  < n; i++) {
        scanf ("%d", &squares[i]);
        sum += squares[i];
    }

    for (i = 0; i < n - 1; i++) {
        partial += squares[i];
        sum -= squares[i];
        if (sum == partial) {
            //printf("%d)
            possibilities++;
        }
    }

    printf("%lld\n", possibilities);
}


#include <stdio.h>
#include <stdlib.h>
int v[100000];

int main()
{
    int n,s,actual,pos,i;
    scanf("%d",&n);
    s=0;
    for(i=0;i<n;i++)
    {
    	scanf("%d",&v[i]);
    	s=s+v[i];
    }
    actual=v[0];
    n--;
    i=1;
    pos=0;
    while(i<=n)
    {
    	if(actual*2==s)
			pos++;
		actual=actual+v[i];
		i++;
    }
    printf("%d",pos);
    return 0;
}


#include<stdio.h>

long int list[100001];

int main(void){
	int n,i,count=0;
	long int sum1,sum2=0;
	scanf("%d",&n);
	for(i=0;i<n-1;i++){
		scanf("%ld ",&(list[i]));
		if(i==0)sum1=list[i];
		else sum2+=list[i];
	}
	scanf("%ld",&(list[i]));
	sum2+=list[i];
	//printf("%lld %lld %lld\n",sum1,sum2,list[i]);
	for(i=0;i<n-1;i++){
		if(sum1==sum2){
			count++;
		}
		sum1+=list[i+1];
		sum2-=list[i+1];
		//printf("%lld %lld %lld\n",sum1,sum2,list[i+1]);
	}
	printf("%d\n",count);
	return 0;
}


#include<stdio.h>

long long int list[100001];

int main(void){
	int n,i,count=0;
	long long int sum1,sum2=0;
	scanf("%lld",&n);
	for(i=0;i<n-1;i++){
		scanf("%lld ",&(list[i]));
		if(i==0)sum1=list[i];
		else sum2+=list[i];
	}
	scanf("%lld",&(list[i]));
	sum2+=list[i];
	//printf("%lld %lld %lld\n",sum1,sum2,list[i]);
	for(i=0;i<n-1;i++){
		if(sum1==sum2){
			count++;
		}
		sum1+=list[i+1];
		sum2-=list[i+1];
		//printf("%lld %lld %lld\n",sum1,sum2,list[i+1]);
	}
	printf("%d\n",count);
	return 0;
}


#include<stdio.h>
#include<malloc.h>
int main()
{
int i,n,j,k,count=0,sum=0,temp=0;
scanf("%d",&n);
int *arr=(int *)malloc(n*sizeof(int));
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
sum=sum+arr[i];
}
for(i=0;i<n-1;i++)
{
temp=arr[i]+temp;
if(sum-temp==temp)
count++;
}
printf("%d\n",count);
return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
int n[100000];
main()
{
	int s1=0,s2=0;
	int a,i,count=0;
	scanf("%d",&a);
	for(i=0;i<a;i++)
	{
		scanf("%d",&n[i]);
		s2+=n[i];
	}
	for(i=0;i<(a-1);i++)
	{
		s1+=n[i];
		s2-=n[i];
		if(s1==s2)
			count++;
	//printf("s1= %lld\ts2= %lld\tcount= %d\t\n",s1,s2,count);

	}
	printf("%d\n",count);
	return 0;
}


#include <stdio.h>
int a[1000005];
int main()
{
    int n,i,m,sum,ans;
    while(scanf("%d",&n)!=EOF)
    {
        m=0,sum=0,ans=0;
        for(i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
            sum+=a[i];
        }
        for(i=1;i<=n;i++)
        {

            if(ans*2==sum)
            {
                m++;
            }
            ans+=a[i];
        }
        if(m==0)
        {
            printf("0\n");
        }
        else
        {
             printf("%d\n",m-1);
        }

    }
    return 0;
}


#include <stdio.h>
int a[1000005];
int main()
{
    int n,i,m,sum,ans;
    while(scanf("%d",&n)!=EOF)
    {
        m=0,sum=0;
        for(i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
            sum+=a[i];
        }
        ans=a[1];
        for(i=2;i<=n;i++)
        {

            if(ans*2==sum)
            {
                m++;
            }
            ans+=a[i];
        }

             printf("%d\n",m);

    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
long long arr[1000001];
char str[1000001];
int func(const void *a, const void *b)
{
	return (*(int*)a-*(int*)b);
}
long long max(long long a, long long b)
{
	return (a>b)?a:b;
}
long long min(long long a, long long b)
{
	return (a>b)?b:a;
}
int main()
{
	long long int n, i, j, k, sum=0, count=0, ans=0;
	scanf("%lld", &n);
	for(i=1;i<=n;i++)
	{
		scanf("%lld", &arr[i]);
		sum+=arr[i];
	}
	if(sum%2)
		printf("0\n");
	else
	{
		for(i=1;i<n;i++)
			arr[i+1]=arr[i]+arr[i+1];
		for(i=1;i<n;i++)
			if(arr[i]==sum/2)
				count++;
		printf("%lld\n",count);
	}

	return 0;
}


#include <stdio.h>

int main()
{
    int n;
    scanf("%d", &n);
    int a[n];
    int sum = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        sum += a[i];
    }
    int count = 0;
    int localSum = 0;
    for (int i = 0; i < n - 1; i++) {
        localSum += a[i];
        if (localSum * 2 == sum) {
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}


#include<stdio.h>

// codeforces.com/problemset/problem/18/C
#define mod(x) ((x >= 0)? x : -1 * x)
int main(){

	int n;
	scanf("%d", &n);

	int tape[n];
	for(int i = 0; i < n; i++)
		scanf("%d", &tape[i]);

	int sum[n];
	sum[0] = tape[0];
	for(int i = 1; i < n; i++)
		sum[i] = sum[i - 1] + tape[i];

	int cut;
	for(int i = 0; i < n; i++){
		if(sum[i] * 2 == mod(sum[n - 1])){
			cut = i + 1;
			break;
		}
	}

	printf("%d ", cut);

	/*for(int i = 0; i < n; i++)
		printf("%d ", tape[i]);

	printf(" \n");

	for(int i = 0; i < n; i++)
		printf("%d ", sum[i]);*/

	return 0;
}


#include<stdio.h>

// codeforces.com/problemset/problem/18/C

int main(){
	int n;
	scanf("%d", &n);

	int tape[n];
	for(int i = 0; i < n; i++)
		scanf("%d", &tape[i]);

	int sum[n];
	sum[0] = tape[0];
	for(int i = 1; i < n; i++)
		sum[i] = sum[i - 1] + tape[i];

	int cut = 0;
	for(int i = 0; i < n-1; i++)
		if(sum[i] == sum[n - 1] - sum[i]) cut++;

	printf("%d", cut);

	return 0;
}


#include <stdio.h>
#include <string.h>
int a[100010];
int sum[100010];
int main()
{
	int n,count,i;
	while(scanf("%d",&n)!=EOF)
	{
		count=0;
		memset(sum,0,sizeof(0));
		for(i=1;i<=n;i++)
		{
			scanf("%d",&a[i]);
			sum[i]+=a[i]+sum[i-1];
		}
		for(i=1;i<n;i++)
		{
			if(sum[i]==sum[n]-sum[i])
				count++;
		}
		printf("%d\n",count);
	}
}


#include<stdio.h>
int main(){
	int a[100005],ans=0,s,i,j,k,l,n,m,sum=0,sum1=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	for(i=0;i<n-1;i++){
		sum1+=a[i];
		sum-=a[i];
		if(sum1==sum)
			ans++;
	}
	printf("%d\n",ans);
	return 0;
}


#ifdef ONLINE_JUDGE
    #define NDEBUG 1
#endif
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <math.h>

#define long int64_t
#define fore(i,k,n) for (int _k = (k), _n = (n), i = _k; i <= _n; ++i)
#define forr(i,n,k) for (int _k = (k), _n = (n), i = _n; i >= _k; --i)
#define scani(x) int x; scanf("%d", &x)
#define scans(x) static char x[LEN]; scanf("%s", x)
#define LIST_INIT_CAP 4
#define HASH_INIT_CAP 64
#define HASH_SKIP 11
#define TREE_INIT_CAP 1024
#define TREE_MAX_HEIGHT 64
#define DEQUE_INIT_CAP 1024
#define HEAP_INIT_CAP 1024
#define TAKEN 1
#define EMPTY 0
#define TOMB -1
#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))

#define N 100004

int arr[N], farr[N], barr[N];

int main() {
    scani(n);
    fore (i, 1, n) {
        scanf("%d", &arr[i]);
    }
    fore (i, 1, n) farr[i] = arr[i] + farr[i-1];
    forr (i, n, 1) barr[i] = arr[i] + barr[i+1];
    int answer = 0;
    fore (i, 1, n-1) if (farr[i] == barr[i+1]) ++answer;
    printf("%d", answer);

    return 0;
}


#include <stdio.h>

int main()
{
     int n, res = 0, sum1 = 0, sum2 = 0, i;
     int a[100000];

     scanf("%d", &n);

     for (i = 0; i < n; i++) {
	  scanf("%d", &a[i]);

	  sum2 += a[i];
     }

     for (i = 0; i < n - 1; i++) {
	  sum1 += a[i];
	  sum2 -= a[i];

	  if (sum1 == sum2) res++;
     }

     printf("%d\n", res);

     return 0;
}


#include <stdio.h>

int main(void) {
	int n,i,j;
		int count=0,sum=0;
		 scanf("%d",&n);
		 int arr[n];
		for(i=0;i<n;i++)
		{
			scanf("%d",&arr[i]);

		}

		for(i=0;i<n-1;++i)
		{
			sum=sum+arr[i];
		int	sum2=0;
			for(j=i+1;j<n;j++)
			{
				sum2=sum2+arr[j];

			}
			if(sum==sum2)
				++count;

		}
	printf("%d",count);
	return 0;
}


#include <stdio.h>

int main(void) {
	int n,i,j;
		int count=0,sum=0,sum2=0;
		 scanf("%d",&n);
		 int arr[n];
		for(i=0;i<n;++i)
		{
			scanf("%d",&arr[i]);

		}

		for(i=0;i<n-1;++i)
		{
			sum=sum+arr[i];
			sum2=0;
			for(j=i+1;j<n;++j)
			{
				sum2=sum2+arr[j];

			}
			if(sum==sum2)
				count++;

		}
	printf("%d",count);
	return 0;
}


#include <stdio.h>

int main(void) {
	int n,i,j;
		int count=0,sum=0,sum2=0;
		 scanf("%d",&n);
		 int arr[n];
		for(i=0;i<n;i++)
		{
			scanf("%d",&arr[i]);
			sum2=sum2+arr[i];

		}

		for(i=0;i<n-1;i++)
		{
			sum=sum+arr[i];
		sum2=sum2-arr[i];
			if(sum==sum2)
				count++;

		}
	printf("%d",count);
	return 0;
}


#include <stdio.h>

int main(void) {
	int n,i,j;
		int count=0,sum=0,sum2=0;
		 scanf("%d",&n);
		 int arr[n];
		for(i=0;i<n;i++)
		{
			scanf("%d",&arr[i]);

		}

		for(i=0;i<n-1;++i)
		{
			sum=sum+arr[i];
			sum2=0;
			for(j=i+1;j<n;j++)
			{
				sum2=sum2+arr[j];

			}
			if(sum==sum2)
				count++;

		}
	printf("%d",count);
	return 0;
}


#include <stdio.h>

int main() {
  int number;
  int array[100000];
  int sum[100001];
  int i;

  sum[0] = 0;
  scanf("%d", &number);
  for (i = 0; i < number; i++) {
    scanf("%d", &array[i]);
    sum[i + 1] = sum[i] + array[i];
  }

  int count = 0;

  for (i = 1; i < number; i++) {
    if (sum[i] == sum[number] - sum[i]) {
      count++;
    }
  }

  printf("%d\n", count);
  return 0;
}


#include <stdio.h>
int n,ans,sum[100010];
int main()
{
    int i;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&sum[i]);
        sum[i] += sum[i-1];
    }
    for(i=1;i<n;i++) if(sum[i]*2 == sum[n]) ans++;
    printf("%d",ans);
    return 0;
}


#include <stdio.h>

#define MAXN 100002

int sum;
int d[MAXN];
int n;

void dosome()
{
	int sub;
	int tot;
	int i;

	sub = 0;
	tot = 0;
	for(i = 0;i < n - 1; i++)
	{
		sub += d[i];
		if(sub + sub == sum)
			tot++;
	}
	printf("%d\n", tot);
}

int main()
{
	int i;
	while(scanf("%d", &n) != EOF)
	{
		sum = 0;
		for(i = 0;i < n; i++)
		{
			scanf("%d", d + i);
			sum += d[i];
		}
		dosome();
	}
	return 0;
}


#include <stdio.h>

int main( void ) {
     const int Max = 100000;
     int seq[Max];
     long long sum = 0;
     int res = 0, i;

     int n;
     scanf("%i", &n);

     for( i = 0; i < n; i++ ) {
          scanf("%i", &seq[i]);
          sum += seq[i];
     }

     int s = 0;
     for( i = 0; i < n-1; i++ ) {
          s += seq[i];

          if( s == (sum - s) ) res ++;
     }

     printf("%i\n", res);

     return 0;
}


//      Stripe.c
//
//      Copyright 2012 Administrator <cpy@ubuntu>
//
//      This program is free software; you can redistribute it and/or modify
//      it under the terms of the GNU General Public License as published by
//      the Free Software Foundation; either version 2 of the License, or
//      (at your option) any later version.
//
//      This program is distributed in the hope that it will be useful,
//      but WITHOUT ANY WARRANTY; without even the implied warranty of
//      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//      GNU General Public License for more details.
//
//      You should have received a copy of the GNU General Public License
//      along with this program; if not, write to the Free Software
//      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//      MA 02110-1301, USA.

#include <stdio.h>

typedef long long ll;

int s[100000];

void func(int n)
{
	int a = 0, i;
	ll sum = 0, add = s[0];
	for (i = 0; i < n; i ++)
	{
		sum += s[i];
	}
	for (i = 1; i < n; i ++)
	{
		if (add == sum - add)
		{
			a ++;
		}
		add += s[i];
	}
	printf("%d\n", a);
}

int main(int argc, char **argv)
{
	int n, i;
	while (scanf("%d", &n) == 1)
	{
		for (i = 0; i < n; i ++)
		{
			scanf("%d", &s[i]);
		}
		func(n);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main() {
	int n, *aa;
	int i, sum, sum2, cnt;

	scanf("%d", &n);
	aa = malloc(n * sizeof(*aa));
	sum = sum2 = cnt = 0;
	for (i = 0; i < n; i++) {
		scanf("%d", &aa[i]);
		sum += aa[i];
	}

	if (sum % 2 != 0) {
		printf("0\n");
		return 0;
	}

	for (i = 0; i < n - 1; i++) {
		sum2 += aa[i];
		if (sum2 == sum / 2)
			cnt++;
	}
	printf("%d\n", cnt);
	return 0;
}


#include <limits.h>
#include <stdio.h>
#include <stdlib.h>

int main() {
	int n, *aa;
	int i, sum, cnt;

	scanf("%d", &n);
	aa = malloc(sizeof(*aa) * n);
	sum = cnt = 0;
	for (i = 0; i < n; i++) {
		scanf("%d", &aa[i]);
		sum += aa[i];
	}

	printf("%d %d\n", INT_MAX, INT_MIN);
	if (sum % 2 == 1)
		printf("0\n");
	else {
		int sum2 = 0;

		for (i = 0; i < n - 1; i++) {
			sum2 += aa[i];
			if (sum2 == sum / 2)
				cnt++;
		}
		printf("%d\n", cnt);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main() {
	int n, *aa;
	int i, sum, cnt;

	scanf("%d", &n);
	aa = malloc(sizeof(*aa) * n);
	sum = cnt = 0;
	for (i = 0; i < n; i++) {
		scanf("%d", &aa[i]);
		sum += aa[i];
	}

	if (sum % 2 == 1)
		printf("0\n");
	else {
		int sum2 = 0;

		for (i = 0; i < n - 1; i++) {
			sum2 += aa[i];
			if (sum2 == sum / 2)
				cnt++;
		}
		printf("%d\n", cnt);
	}
	return 0;
}


/* Sachin Chandani */

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stdbool.h>
#include<limits.h>
#include<assert.h>
#include<time.h>

#define inp(x) scanf("%d",&x)
int min(int a,int b);
int max(int a,int b);
int cmp(const void * a,const void *b);

int main()
{
	int n;
	int a[100005]={0};
	int ans=0;
	long long int sum[100005]={0};
	sum[0]=0;
	inp(n);
	for(int i=1;i<=n;i++)
	{
		inp(a[i]);
		sum[i]=sum[i-1]+a[i];
	}
	for(int i=1;i<n;i++)
	{
		if(2*sum[i]==sum[n]) ans++;
	}
	printf("%d\n",ans);

	//	qsort( , ,sizeof(int),cmp);
	return 0;
}
int min(int a,int b)
{
	return (a>b?b:a);
}

int max(int a,int b)
{
	return (a<b?b:a);
}

int cmp(const void * a,const void *b)
{
	return(*(int*)a-*(int*)b);
}


#include<stdio.h>
int i,n,arr[1000005],x,sum,temp;
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&x),arr[sum+=x]++;
	printf("%d",!sum ? arr[0]-1 : (sum&1) ? 0 : arr[sum/2]);
	return 0;
}


#include<stdio.h>
int i,n,arr[1000005],x,s,sum,temp;
int main(){
	scanf("%d",&n);
	scanf("%d",&arr[1]);
	for(i=2;i<=n;i++)
		scanf("%d",&x),arr[i] = arr[i-1]+x;
	for(i=1;i<n;i++)
		if(arr[i]*2 == arr[n]) s++;
	printf("%d\n",s);
	return 0;
}


#include<stdio.h>
int i,n,arr[100005],x,sum,temp;
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&x),arr[sum+=x]++;
	printf("%d",!sum ? 0 : (sum&1) ? 0 : arr[sum/2]);
	return 0;
}


#include<stdio.h>
int i,n,arr[100005];
double sum,temp;
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&arr[i]),sum+=arr[i];
	i=1;
	while(i<=n){
		temp += arr[i++];
	//	getchar();
	//	printf("%d\n",temp);
		if(temp == sum/2)
			return printf("%d\n",i-1); 0;

	}
//	if(temp == sum) printf("%d",i-1);
//	else
		puts("0");
	return 0;
}


#include<stdio.h>
int i,n,arr[100005];
double sum,temp;
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&arr[i]),sum+=arr[i];
	i=1;
	while(i<=n){
		temp += arr[i++];
	//	getchar();
	//	printf("%d\n",temp);
		if(temp == sum/2){
			printf("%d\n",i-1);
			return 0;
		}

	}
//	if(temp == sum) printf("%d",i-1);
//	else
		puts("0");
	return 0;
}


#include<stdio.h>
int i,n,arr[100005],x,sum,temp;
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&x),arr[sum+=x]++;
	printf("%d",!sum ? arr[0]-1 : (sum&1) ? 0 : arr[sum/2]);
	return 0;
}


#include "stdio.h"

int main(void) {

  int n;
  scanf("%d", &n);

  int arr[n];

  int sum_1 = 0;
  int sum_2 = 0;
  int cuts = 0;

  for(int i = 0; i < n; i++){
    scanf("%d", &arr[i]);
    sum_2 += arr[i];
  }

  for(int i = 0; i < n - 1; i++){
    sum_1 += arr[i];
    sum_2 -= arr[i];

    if(sum_1 == sum_2) cuts++;
  }

  printf("%d", cuts);

  return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    unsigned int i, N;
    long long int num, *sums;
    scanf("%u", &N);
    sums = (long long int *)malloc(N*sizeof(long long int));
    for(i = 0; i < N; i++){
        scanf("%lld", num);
        if(i == 0)
            sums[i] = num;
        else
            sums[i] = sums[i-1]+num;
    }
    unsigned int goodcut = 0;
    for(i = 0; i < N-1; i++){
        if(sums[i] == sums[N-1]-sums[i])
            goodcut++;
    }
    printf("%u", goodcut);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    unsigned int i, N;
    long long int num, *sums;
    scanf("%u", &N);
    sums = (long long int *)malloc(N*sizeof(long long int));
    for(i = 0; i < N; i++){
        scanf("%lld", &num);
        if(i == 0)
            sums[i] = num;
        else
            sums[i] = sums[i-1]+num;
    }
    unsigned int goodcut = 0;
    for(i = 0; i < N-1; i++){
        if(sums[i] == sums[N-1]-sums[i])
            goodcut++;
    }
    printf("%u", goodcut);
    return 0;
}


#include <stdio.h>

int main()
{
    int i, sum_total = 0, sum, n, count = 0;

    scanf("%d", &n);
    int a[n];

    for (i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        sum_total += a[i];
    }

    sum = a[0];
    if (sum == (sum_total - sum)) count++;

    for (i = 1; i <= n - 2; i++)
    {
        sum += a[i];
        if (sum == (sum_total - sum)) count++;
    }

    printf("%d\n", count);

    return 0;
}


#include <stdio.h>

int main()
{
    int i, sum_total = 0, sum, n, count = 0;

    scanf("%d", &n);

    int a[n];

    for (i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        sum_total += a[i];
    }

    if (n == 1) printf("%d\n", 0);
    else
    {
        sum = a[0];
        if (sum == (sum_total - sum)) count++;

        for (i = 1; i <= n - 2; i++)
        {
            sum += a[i];
            if (sum == (sum_total - sum)) count++;
        }

        printf("%d\n", count);
    }

    return 0;
}


#include <stdio.h>

int main(){

	int n;
	scanf("%d",&n);
	int numbers[n];

	int firstPart=0;
	int secondPart=0;
	int total=0;

	int i,k;
	for(i=0;i<n;i++)
	{
		scanf("%d",&numbers[i]);
		secondPart+=numbers[i];
	}

	for(i=0;i<n-1;i++)
	{
		firstPart+=numbers[i];
		secondPart-=numbers[i];
		if(firstPart == secondPart)
		{
			total++;
		}

	}
	printf("%d\n",total);
	return 0;
}


#include <stdio.h>

int main(){

	int n;
	scanf("%d",&n);
	int numbers[n];

	int firstPart=0;
	int secondPart=0;
	int total=0;

	int i,k;
	for(i=0;i<n;i++)
	{
		scanf("%d",&numbers[i]);
	}

	for(i=0;i<n-1;i++)
	{
		firstPart+=numbers[i];
		for(k=i+1;k<n;k++)
		{
			secondPart+=numbers[k];
		}

		if(firstPart == secondPart)
		{
			total++;
		}
		secondPart=0;
	}
	printf("%d\n",total);
	return 0;
}


#include <stdio.h>
#include <string.h>
int main()
{
    int n;
    int i, j, k;
    int sum, sum2;
    int num[100002];

    while (scanf("%d", &n) == 1) {
        sum = 0;
        for (i = 1; i <= n; i++) {
            scanf("%d", &num[i]);
            sum += num[i];
        }
        if ((sum & 1) || n == 1) {
            printf("0\n");
            continue;
        }
        sum /= 2;
        sum2 = 0;
        k = 0;
        for (i = 1; i < n; i++) {
            sum2 += num[i];
            if (sum2 == sum) {
                k++;
            }
        }
        printf("%d\n", k);
    }
    return 0;
}


#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    int arr[n];
	for(int i=0;i<n;++i)
	{
		scanf("%d",&arr[i]);
	}
	int sum1=0;
	int cnt=0;
	int j,k,i;
	int sum2=0;
	for(i=0;i<n-1;++i)
	{
		sum1=0;
		sum2=0;
		for(j=i+1;j<n;++j)
		{
			sum2+=arr[j];
		}
		for(k=0;k<=i;++k)
			{
				sum1+=arr[k];
			}
		if(sum1==sum2)
			++cnt;
	}
	printf("%d",cnt);
	return 0;
}


#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    int arr[n];
    int sum=0;
	for(int i=0;i<n;++i)
	{
		scanf("%d",&arr[i]);
		sum+=arr[i];
	}
	int sum1=0;
	int cnt=0;
	int j,k,i;
	for(i=0;i<n-1;++i)
	{
		sum1+=arr[i];
		sum-=arr[i];
		if(sum1==sum)
			++cnt;
	}
	printf("%d",cnt);
	return 0;
}


#include<stdio.h>
long arr[100000];
int main()
{
    long i,n,ans=0;
    scanf("%ld",&n);
    if(n!=0)
    scanf("%ld",&arr[0]);
    for(i=1;i<n;++i)
    {
        scanf("%ld",&arr[i]);
        arr[i]+=arr[i-1];
    }
    for(i=0;i<n-1;++i)
    if(2*arr[i]==arr[n-1])
    ++ans;
    printf("%ld",ans);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{long long int i,j,s,t,k,n,a[100005]={0};
scanf("%I64d",&n);
for(i=0;i<n;i++)
{scanf("%I64d",&a[i]);
s+=a[i];
}k=0;t=0;
for(i=0;i<n-1;i++)
{t+=a[i];
    if(t==s-t)
    k++;
}
printf("%I64d",k);
return 0;
}


#include<stdio.h>
#define MAX 1000005

int main()
{
	int i,n,arr[MAX],x,s,sum,temp;
	scanf("%d",&n);
	scanf("%d",&arr[1]);
	for(i=2;i<=n;i++)
		scanf("%d",&x),arr[i] = arr[i-1]+x;
	for(i=1;i<n;i++)
		if(arr[i]*2 == arr[n]) s++;
	printf("%d\n",s);
	return 0;
}


#include<stdio.h>
int main()
{
	int i,n,x,ans,temp;
	long long int sum[100009];
	scanf("%d",&n);
	sum[0]=0;
	for(i=1;i<=n;i++)
	{
		scanf("%d",&x);
		sum[i]=sum[i-1]+x;
	}
	ans=0;
	if(sum[n]%2!=0)
	{
		ans=0;
	}
	else
	{
		temp=sum[n]/2;
		for(i=1;i<=n-1;i++)
		{
			if(sum[i]==temp)
			{
				ans++;
			}
		}
	}
	printf("%d\n",ans);
}


#include<stdio.h>
int main()
{
	int a;
	scanf("%d",&a);
	int i;
	int b[a];
	int count=0;
	for(i=0;i<a;i++)
	{
		scanf("%d",&b[i]);
		count=count+b[i];
	}
	if(count%2!=0)
	{
		printf("0\n");
	}
	else
	{
		int count1=0;
		int count2=0;
		int w = count/2;
		for(i=0;i<a-1;i++)
		{
			count1 = count1 + b[i];
			if(count1==w)
			{
				count2++;
			}
		}
		printf("%d\n",count2);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) {

    int i;
    int n;
    int *a;
    int sum = 0;
    int result = 0;
    int cur = 0;

    scanf("%d", &n);

    a = (int *)malloc(n * sizeof(int));

    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        sum += a[i];
    }

    if (sum % 2) {
        printf("0\n");
        return 0;
    }

    sum /= 2;

    for (i = 0; i < n - 1; i++) {
        cur += a[i];
        if (cur == sum) {
            result++;
        }
    }

    printf("%d\n", result);

    free(a);
    return 0;
}

/* vim:set ts=4 sw=4 et: */


#include<iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//using namespace std;

int main()
{
        int n,i,dp[100001];
        int count=0;

        scanf("%d",&n);

        dp[0]=0;

        for(i=1;i<=n;i++)
        {
           scanf("%d",dp[i]);
           dp[i]+=dp[i-1];
        }

    for(i=1;i<n;i++)
        if(dp[i]==dp[n]-dp[i])
           count++;

    printf("%d\n",count);
 //system("PAUSE");
        return 0;
}

/****** PCCA -Wed Aug 24 03:05:58 GMT 2011 *******/


//#include<iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//using namespace std;

int main()
{
        int n,i,dp[100001];
        int count=0;

        scanf("%d",&n);

        dp[0]=0;

        for(i=1;i<=n;i++)
        {
           scanf("%d",dp[i]);
           dp[i]+=dp[i-1];
        }

    for(i=1;i<n;i++)
        if(dp[i]==dp[n]-dp[i])
           count++;

    printf("%d\n",count);
 //system("PAUSE");
        return 0;
}

/****** PCCA -Wed Aug 24 03:06:17 GMT 2011 *******/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//using namespace std;

int main()
{
        int n,i,dp[100001];
        int count=0;

        scanf("%d",&n);

        dp[0]=0;

        for(i=1;i<=n;i++)
        {
           scanf("%d",&dp[i]);
           dp[i]+=dp[i-1];
        }

    for(i=1;i<n;i++)
        if(dp[i]==dp[n]-dp[i])
           count++;

    printf("%d\n",count);
 //system("PAUSE");
        return 0;
}

/****** PCCA -Wed Aug 24 03:07:17 GMT 2011 *******/


#include <stdio.h>
#define MAX 10001

long long pref[MAX];
int n;

int main()
{
	int i, k;
	long long sum = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &k);
		sum += k;
		pref[i] = sum;
	}

	int count = 0;
	for (i = 0; i < n-1; i++)
		if (pref[i] == sum-pref[i])
			count++;
	printf("%d\n", count);

	return 0;
}