# -*- coding: utf-8 -*-

"""
計算式は以下のように示される
C_n = (1/n)*(1+C_(n-1)) + ((n-1)/n)*C_(n-1)  =  C_(n-1)+(1/n)
"""
import math
N = int(input())
X = list(map(int, input().split()))

def calc(n):
    if n==1:
        return 1
    return calc(n-1)+(1.0/n)

result = []
for i in range(1, N):
    result.append((X[i]-X[i-1])*calc(i))
        
print(int(sum(result)*math.factorial(N-1)))