#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
long long n,a[1000010],sum[1000010];
long long ans;
int main(){
cin>>n;
cin>>a[0];
for(int i=1;i<n;i++){
cin>>a[i];
ans+=a[i]*a[i-1];
a[i]+=a[i-1];
}
cout<<ans;
}