def factorial(n): res = 1 for i in range(2,n+1): res *=i return res m = int(input()) ans = 0 for t in range(1,m+1): ans += factorial(t) print(ans)