#include <bits/stdc++.h>   using namespace std;   int main() {     int n, a[200000], money, energy, i;     scanf( %d , &n);     for (i = 0; i <= n - 1; i++) {       scanf( %d , &a[i]);     }     energy = 0;     money = a[0];     for (i = 0; i <= n - 2; i++) {       if (energy + a[i] - a[i + 1] < 0) {         money += a[i + 1] - a[i] - energy;         energy = 0;       } else {         energy += a[i] - a[i + 1];       }     }     printf( %d n , money);     return 0;   }   