n = gets.to_i
ans = gets.split.map(&:to_i).inject(:+)
puts ans - gets.to_i