def main(): N = int(input()) A = list(map(int, input().split())) wrong_ans = int(input()) print(sum(A)-wrong_ans) if __name__ == "__main__": main()