fork(1) download
  1. n=int (input ())
  2. cnt=[0 for i in range (3)]
  3. for it in input (). split () :
  4. cnt [int(it)-1]+=1
  5. cnt=sorted (cnt)
  6. ans="No"
  7. if cnt[0]>=1 or (cnt[1]>=2 and cnt[2]>=2) or (cnt[1]>=1 and cnt[2]>=5):
  8. ans="Yes"
  9. print (ans)
Success #stdin #stdout 0.01s 28384KB
stdin
6
1 2 2 3 3 3
stdout
Yes