n,*d=$<.read.split.map &:to_i n.times{|i|c=0;o=i;(c+=1;d[o],o=p,d[o]-1)while d[o];$*[c]^=c&1<1} puts$*.any?? :No:'Yes'