package main import . "fmt" import . "os" import bf "bufio" func main() { rd:=bf.NewReader(Stdin) var n,m int Fscan(rd,&n,&m) cs:=make([]int,n) t:=make(map[int]int) for i:=range cs { Fscan(rd,&cs[i]) t[cs[i]]++ } for ;m>0;m-- { var u,v int Fscan(rd,&u,&v) u-- v-- if cs[u]==cs[v] { t[cs[u]]-- } } var ans int for _,c:=range t { ans+=c-1 } Println(ans) }