func_code_string: #include <bits/stdc++.h>   using namespace std;   long long ar[100005];   long long N;   int main() {     cin >> N;     for (long long i = 0; i < N; i++) cin >> ar[i];     long long ans = 0ll;     for (long long i = 0; i < N; i++) {       long long lft = (i == 0 ? 0 : ar[i - 1]);       if (ar[i] < lft) ans += (ar[i]) * (lft - ar[i]);       if (ar[i] > lft) ans += (ar[i] - lft) * (N - ar[i] + 1);     }     cout << ans << endl;     return (0);   }   