#!/usr/bin/env python3
n = int(input())
xs = map(int,input().split())
y = int(input())
print(sum(xs) - y)