N = gets.to_i P = gets.split.map(&:to_i) if N == 1 puts 0 else puts (2..N).sum - 1 end