#!/usr/bin/env python3
# Atcoder necoak answer
# https://atcoder.jp/contests/abc191/tasks/abc191_a
from itertools import combinations

n = int(input())
a_list  = list(map(int, input().split()))

def calc_sajijou(tpl):
    return (tpl[0] - tpl[1]) ** 2

ans = sum(map(calc_sajijou, combinations(a_list, 2)))
print(ans)

09fa37bb5a353ed3ddfc8fa5f27608b6ed689a75
<mask token>


def calc_sajijou(tpl):
    return (tpl[0] - tpl[1]) ** 2


<mask token>

<mask token>


def calc_sajijou(tpl):
    return (tpl[0] - tpl[1]) ** 2


<mask token>
print(ans)

<mask token>
n = int(input())
a_list = list(map(int, input().split()))


def calc_sajijou(tpl):
    return (tpl[0] - tpl[1]) ** 2


ans = sum(map(calc_sajijou, combinations(a_list, 2)))
print(ans)

from itertools import combinations
n = int(input())
a_list = list(map(int, input().split()))


def calc_sajijou(tpl):
    return (tpl[0] - tpl[1]) ** 2


ans = sum(map(calc_sajijou, combinations(a_list, 2)))
print(ans)

#!/usr/bin/env python3
# Atcoder necoak answer
# https://atcoder.jp/contests/abc191/tasks/abc191_a
from itertools import combinations

n = int(input())
a_list  = list(map(int, input().split()))

def calc_sajijou(tpl):
    return (tpl[0] - tpl[1]) ** 2

ans = sum(map(calc_sajijou, combinations(a_list, 2)))
print(ans)
