let n = Int(readLine()!)!

var arr = readLine()!.characters.split{$0 == " "}.map{ Int(String($0))! }

let a = arr.sort { $0 > $1 }

var i = 0
var level = 2
var bad = false

while i < a.count/2 {
  
  for j in i+1 ..< level {
    if a[j] >= a[i] { 
      bad = true
    }
  }
  
  if bad {
    break
  }
  i = level - 1
  level *= 2
}

print(bad ? "No" : "Yes")