function main(input) { const n = umber(input[0]); const block_list = input[1].map(parseFloat); let sorted_count = 0; let search_value = n; for (let i = block_list.length;0 <= i;i--) { if (block_list[i] === search_value) { search_value--; sorted_count++; } } console.log(n - sorted_count); } main(require('fs').readFileSync('/dev/stdin', 'utf8').split('\n'));