https://www.acwing.com/problem/content/1605/
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int ans[N];
int n;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>ans[i];
}
sort(ans+1,ans+n+1);
for(int i=1;i<=n;i++){
ans[i]=ans[i-1]+ans[i];
}
printf("%d %d",n%2,ans[n]-ans[n/2]*2);
return 0;
}