import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No369 { public static void main(String[] args) { try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); String[] str = br.readLine().split(" "); int[] num = new int[N]; int sum =0; for(int i=0; i < N; i++){ num[i] = Integer.parseInt(str[i]); sum += num[i]; } int v = Integer.parseInt(br.readLine()); System.out.println(sum - v); }catch(IOException e){ e.getStackTrace(); }catch(NumberFormatException e){ e.getStackTrace(); } } }