Question
Power of Two Pair SumYou are given an array of KaTeX can only parse string typed expression integers. Your task is to determine whether there exist two elements present at different indices KaTeX can only parse string typed expression and KaTeX can only parse string typed expression such that their sum is a power of 2.
A number is said to be a power of 2 if it can be represented as KaTeX can only parse string typed expression for some integer KaTeX can only parse string typed expression.
Input
The first line contains a single integer KaTeX can only parse string typed expression — the size of the array.
The second line contains KaTeX can only parse string typed expression integers — KaTeX can only parse string typed expression.
The second line contains KaTeX can only parse string typed expression integers — KaTeX can only parse string typed expression.
Output
Print "YES" if there exist two distinct indices KaTeX can only parse string typed expression and KaTeX can only parse string typed expression such that KaTeX can only parse string typed expression is a power of 2. Otherwise, print "NO".
Example
5
1 3 5 7 9
Output
YES
Explanation
The numbers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression can be combined to get KaTeX can only parse string typed expression, which is a power of 2.
Input
4
3 6 7 12
Output
NO
Explanation
No pair of numbers in the array has a sum that is a power of 2.
1 3 5 7 9
Output
YES
Explanation
The numbers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression can be combined to get KaTeX can only parse string typed expression, which is a power of 2.
Input
4
3 6 7 12
Output
NO
Explanation
No pair of numbers in the array has a sum that is a power of 2.