#include <iostream>
using namespace std;
typedef long long LL;
int main()
{
int n;
scanf("%d", &n);
LL sum1 = 0, sum2 = 0;
while (n -- )
{
int x;
scanf("%d", &x);
sum1 += x, sum2 += x * x;
}
printf("%lld\n", (sum1 * sum1 - sum2) / 2);
return 0;
}
#include <iostream>
using namespace std;
typedef long long LL;
const int N = 200010;
int a[N];
LL s[N];
int n;
int main()
{
scanf("%d", &n);
for (int i = 1; i <= n; i ++ ) cin >> a[i], s[i] = s[i - 1] + a[i];
LL sum = 0;
for (int i = 1; i <= n; i ++ )
sum += (LL)a[i] * (s[n] - s[i]);
printf("%lld\n", sum);
return 0;
}