1 #include <iostream> 2 #include <algorithm> 3 #include <cmath> 4 #include <stdio.h> 5 #include <cstring> 6 #include <string> 7 #include <cstdlib> 8 #include <queue> 9 #include <stack> 10 #include <set> 11 #include <vector> 12 #include <map> 13 #include <list> 14 #include <iomanip> 15 #include <fstream> 16 using namespace std; 17 18 typedef long long ll; 19 20 ll a[100007],pos,neg; 21 int main() 22 { 23 ll n,l,r; 24 scanf("%lld",&n); 25 for(int i=1;i<=n;++i) 26 { 27 scanf("%lld",&a[i]); 28 } 29 30 for(int i=n;i>1;i--) 31 { 32 if(a[i]-a[i-1]>0) 33 pos+=a[i]-a[i-1]; 34 else 35 neg+=a[i-1]-a[i]; 36 } 37 38 printf("%lld %lld ",max(pos,neg),abs(pos-neg)+1); 39 return 0; 40 }