n = int(input()) a = list(map(int, input().split())) v = int(input()) ans = sum(a) - v print(ans)