N=int(input()) P=list(map(int,input().split())) print(N*(N+1)//2-2)