Valid pairs
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
A famous Italian restaurant allows guests to enter only if they are present in pairs and the sum of the wealth of the people of the pair is a power of . A group of people wants to eat at the restaurant. Mathematically, if there are two people of wealth and , it forms a valid pair if for some positive integer . They want to know how many possible pairs would be allowed entry.
Input
The first line contains number of guests . The second liine contains the individual wealth of people.
Output
Print the number of valid pairs. It is known that:
One person can be in multiple valid pairs.
A pair of person and is the same as a pair of person and .
Examples
Input #1
Answer #1
Submissions 504
Acceptance rate 22%