
function Main(input) {
    input = input.trim();
    input = input.split("\n")
    input = input.map(e => e.split(" ").map(f => parseInt(f)))

    var tenbou = []

    input[1].forEach(e => {
        tenbou.push({
            h: e,
            childlen: [],
            parents: []
        })
    })

    var input2 = input.slice(2)

    input2.forEach(e => {
        var ten1 = tenbou[e[0] - 1]
        var ten2 = tenbou[e[1] - 1]

        if(ten1.h<ten2.h){
            tenbou[e[0] - 1].parents.push(ten2)
            tenbou[e[1] - 1].childlen.push(ten1)
        }else{
            tenbou[e[0] - 1].childlen.push(ten2)
            tenbou[e[1] - 1].parents.push(ten1)
        }

    })

    var count =0;

    tenbou.forEach(e=>{
        if(e.parents.length ==0)count++;
    })


    console.log(count)

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
