a = gets.to_i

b = gets.split.map(&:to_i)
v = []
b.each do |i|
v << i
end

v.delete_at(0)
v << 1
f = 0
c = []
b.each_with_index do |i, j|
if j == 0
  c << 0
elsif j != 0
  if b[j] > v[j]
    f = b[j] > v[j]
    c << f
  elsif b[j] < v[j]
    c << 0
   end
end
end

c.delete_at(-1)


g = c.sum


puts g