#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define IOS ios::sync_with_stdio(0); cin.tie(0); mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define F first
#define S second
#define PI  4.0*atan(1.0);
#define pb push_back
using namespace std;
typedef pair<int, int> pi;
int mod=1e9+7,gaymod=998244353,MAX=1000000000,pomod=1073741824;
//long long int gcd(long long int x,long long int  y){
  // if(y==0)return x;
   //return gcd(y,x%y);
//}
template<typename T>
T gcd(T x , T y){
if(y==0)return x;
return gcd(y,x%y);
}
template<typename L>
L lcm(L x,L y){
 L g=gcd(x,y);
 return x/g*y;
}
ll binexp(ll a,ll b){
if(b==0)return 1;
ll res=binexp(a,b/2);
if(b%2)return((res%mod)*(res%mod)*(a%mod));
else return((res%mod)*(res%mod));
}
int prime(ll x){
if(x%2==0&&x!=2)
return 0;
else if(x==1)return 0;
else{
    for(int i=3;ll(i*i)<=x;i+=2){
        if(x%i==0)
            return 0;
    }
}
return 1;
}
bool secsort(const pair<int,int> &a,const pair<int,int> &b){
    return(a.S<b.S);
}
//main
/*
vector<char> is_prime(N+1, true);
void sieve(int n){
is_prime[0] = is_prime[1] = false;
for (int i = 2; i <= n; i++) {
    if (is_prime[i] && (long long)i * i <= n) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = false;
    }
}
}
*/
//freopen("input.txt","r",stdin);
//freopen("input.txt","w",stdin);
const int N=2e5+5;
const int Z=1e6+5;

//
int main(){
IOS;
int t=1;
//cin>>t;
while(t--){
int n;
cin>>n;
int arr[n];
map<int,ll> M;
ll ans=0;
for(int i=0;i<n;i++){
cin>>arr[i];
}
M[arr[0]]++;
for(ll i=1;i<n;i++){
 M[arr[i]]++;
 ans+=(i+1)-M[arr[i]];
}
cout<<ans;
cout<<"\n";
}
return 0;
}

//IF YOU GIVE UP,THEN YOU DON'T DESERVE IT

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define PI 3.14159265358979323846264
#define isz(x) (int)x.size()
using namespace std;  
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
 
#define typ int
#define ordered_set tree<typ, null_type, less<typ>, rb_tree_tag, tree_order_statistics_node_update>
//*s.find_by_order(x) --> value at position x(0-indexed)
//s.order_of_key(x)   --> number of elements less than x
#define eps 1e-9
#define int long long

int32_t main()
{
   int n;
   cin>>n;
   int u = 0,v = 0,mx =-INT_MAX;
   for(int i=1;i<=n;i++)
   {
     int x;
     cin>>x;
    mx = max(mx,abs(x));
    u+=abs(x);
    v+=(x*x);
   }
   cout<<u<<" \n"<<setprecision(50)<<sqrt(v)<<" \n"<<mx;
}

