n = int(input()) s = sum(list(map(int,input().split()))) print(s - int(input()))