func_code_string: #include <bits/stdc++.h>   using namespace std;   int arr[5010], n;   int solve(int l, int r, int h) {     int i, j, k;     if (l > r) return 0;     int ans = 0, val = 1000000007;     for (i = l; i <= r; i++) val = min(val, arr[i]);     int pos = l - 1;     ans = val - h;     for (i = l; i <= r; i++) {       if (arr[i] == val) {         ans += solve(pos + 1, i - 1, val);         pos = i;       }     }     ans += solve(pos + 1, r, val);     return min(r - l + 1, ans);   }   int main(void) {     int i, k;     scanf( %d , &n);     for (i = 1; i <= n; i++) scanf( %d , &arr[i]);     k = solve(1, n, 0);     printf( %d  , k);     printf(  n );     ;     return 0;   }   