n = int(input()) nums = sum(map(int, input().split())) ans = int(input()) print(nums - ans)