CF702B Powers of Two

Description

You are given $ n $ integers $ a_{1},a_{2},...,a_{n} $ . Find the number of pairs of indexes $ i,j $ ( $ i<j $ ) that $ a_{i}+a_{j} $ is a power of $ 2 $ (i. e. some integer $ x $ exists so that $ a_{i}+a_{j}=2^{x} $ ).

Input Format

The first line contains the single positive integer $ n $ ( $ 1

Output Format

Print the number of pairs of indexes $ i,j $ ( $ i<j $ ) that $ a_{i}+a_{j} $ is a power of $ 2 $ .

Explanation/Hint

In the first example the following pairs of indexes include in answer: $ (1,4) $ and $ (2,4) $ . In the second example all pairs of indexes $ (i,j) $ (where $ i<j $ ) include in answer.