n = int(input()) l = list(map(int,input().split())) m = int(input()) ans = sum(l) - m print(ans)