import math
N = int(input())
xn = list(map(int, input().split()))

if N > 2000:
    print(0)
    exit()
else:
    ans = 0
    for i in range(N-1):
        for j in range(N-1-i):
            ans += (xn[i+1+j]-xn[i])/(N-1-j)
        for l in range(j):
            ans += (xn[i]-xn[i-j]/(N-1-l))
    print(int(ans*math.factorial(N-1)))
