N=gets.to_i A=gets.split.map &:to_i if N==5 puts A[0]==A[1]&&A[5]!=A[2]&&A[2]!=A[1]&&A[2]!=A[3]&&A[2]!=A[4]&&A[0]!=A[5] ? "YES" : "NO" exit end v=[] N.times{ v=(0...2**v.size).map{|i| t=[] (0...v.size).each{|j|i[j]==1&&t<