const main=input=>{l=input.trim().split("\n");h=l[1].split(" ").map(e=>parseInt(e));r=new Array(h.length).fill(true);l.slice(2).map(e => e.split(" ").map(a => parseInt(a)-1)).map(e=>{a=h[e[0]],b=h[e[1]];(a==b?(r[e[0]]=r[e[1]]=!1):a<b?(r[e[0]]=!1):(r[e[1]]=!1))});return r.filter(e=>e).length};console.log(main(require('fs').readFileSync('/dev/stdin', 'utf8')))