func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   long long ans;   int a[150000 + 1];   int main() {     scanf( %d , &n);     for (register int i = 1; i <= n; ++i) {       scanf( %d , &a[i]);       ans += 1LL * a[i] * (n - a[i] + 1);     }     for (register int i = 1; i <= n; ++i)       ans -= 1LL * min(a[i], a[i + 1]) * (n - max(a[i], a[i + 1]) + 1);     printf( %lld , ans);   }   