#include <bits/stdc++.h>
using namespace std;
int main(){
 
  int n;
  cin >> n;
  vector<long long> a(n), s(n+1, 0);
  for(auto &x : a) cin >> x;
  sort(a.rbegin(), a.rend());
  for(int i = 0; i < n; ++i){
    s[i+1] = s[i] + a[i];
  }
  long long ans = 0;
  for(int I = 1; I <= n; ++I){
    int i = I-1;
    ans += (n-I)*a[i] - (s[n]-s[I]);
  }
  cout << ans << '\n';

  return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<LD> VLD;
typedef vector<string> VS;
#define rep(i, min, max) for (int i = min; i < (int)(max); i++)

int main()
{
  LL N;
  cin>>N;
  VL X(N);
  for(LL& x: X) cin>>x;

  LL m = 0;
  rep(i,0,N) m += abs(X.at(i));

  LD e = 0;
  rep(i,0,N) e += X.at(i)*X.at(i);
  e = sqrt(e);

  LL c = 0;
  rep(i,0,N) c = max(c, abs(X.at(i)));

  cout<<fixed<<setprecision(0)<<m<<endl;
  cout<<fixed<<setprecision(15)<<e<<endl;
  cout<<fixed<<setprecision(0)<<c<<endl;

  return 0;
}
