import math
n=int(input())
l = list(map(int, input().split()))
lr=[]
for i in range(n):
  a=l[-1]-l[i]
  lr.append(a)


maxim=sum(lr)
mini=lr[0]
ans=0
for i in range(mini,maxim+1):
  ans+=i/(n-1)
print(int(ans*math.factorial(n-1)))