n = gets.to_i
sum = gets.split.map(&:to_i).inject(:+)
p sum - gets.to_i