A sequence $a_1, a_2, \dots, a_n$ is called good if, for each element $a_i$, there exists an element $a_j$ ($i \ne j$) such that $a_i+a_j$ is a power of two (that is, $2^d$ for some non-negative integer $d$).

For example, the following sequences are good:
 -  $[5, 3, 11]$ (for example, for $a_1=5$ we can choose $a_2=3$. Note that their sum is a power of two. Similarly, such an element can be found for $a_2$ and $a_3$), -  $[1, 1, 1, 1023]$, -  $[7, 39, 89, 25, 89]$, -  $[]$. 
Note that, by definition, an empty sequence (with a length of $0$) is good.

For example, the following sequences are not good:
 -  $[16]$ (for $a_1=16$, it is impossible to find another element $a_j$ such that their sum is a power of two), -  $[4, 16]$ (for $a_1=4$, it is impossible to find another element $a_j$ such that their sum is a power of two), -  $[1, 3, 2, 8, 8, 8]$ (for $a_3=2$, it is impossible to find another element $a_j$ such that their sum is a power of two). 
You are given a sequence $a_1, a_2, \dots, a_n$. What is the minimum number of elements you need to remove to make it good? You can delete an arbitrary set of elements.
The first line contains the integer $n$ ($1 \le n \le 120000$) — the length of the given sequence.

The second line contains the sequence of integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^9$).
6
4 7 1 5 4 9
1
5
1 2 3 4 5
2
1
16
1
4
1 1 1 1023
0
10
2 10 9 1 10 4 7 8 5 4
5
2
1 1
0
2
1 6
2
6
1 7 7 7 7 7
0
3
1 2 3
1
3
1 3 3
0
2
3 3
2
2
3 1
0
3
1 2 2
1
2
2 2
0
2
2 1
2
3
1 1 3
0
3
1 3 2
1
3
1 1 2
1
1
1
1
import random
import sys

from collections import defaultdict


# sys.setrecursionlimit(10**8)设置最大递归次数


class FastIO:
    def __init__(self):
        self.seed = random.randint(0, 10 ** 9 + 7)
        self.dct = dict()
        return

    @staticmethod
    def read_int():
        return int(sys.stdin.readline().strip())

    @staticmethod
    def read_float():
        return float(sys.stdin.readline().strip())

    @staticmethod
    def read_ints():
        return map(int, sys.stdin.readline().strip().split())

    @staticmethod
    def read_floats():
        return map(float, sys.stdin.readline().strip().split())

    @staticmethod
    def read_ints_minus_one():
        return map(lambda x: int(x) - 1, sys.stdin.readline().strip().split())

    @staticmethod
    def read_list_ints():
        return list(map(int, sys.stdin.readline().strip().split()))

    @staticmethod
    def read_list_floats():
        return list(map(float, sys.stdin.readline().strip().split()))

    @staticmethod
    def read_list_ints_minus_one():
        return list(map(lambda x: int(x) - 1,
                        sys.stdin.readline().strip().split()))

    @staticmethod
    def read_str():
        return sys.stdin.readline().strip()

    @staticmethod
    def read_list_strs():
        return sys.stdin.readline().strip().split()

    @staticmethod
    def read_list_str():
        return list(sys.stdin.readline().strip())

    @staticmethod
    def st(x):
        return sys.stdout.write(str(x) + '\n')

    @staticmethod
    def lst(x):
        return sys.stdout.write(" ".join(str(w) for w in x) + '\n')

    @staticmethod
    def round_5(f):
        res = int(f)
        if f - res >= 0.5:
            res += 1
        return res

    @staticmethod
    def max(a, b):
        return a if a > b else b

    @staticmethod
    def min(a, b):
        return a if a < b else b

    @staticmethod
    def ceil(a, b):
        return a // b + int(a % b != 0)

    def ask(self, lst):
        # CF交互题输出询问并读取结果
        self.lst(lst)
        sys.stdout.flush()
        res = self.read_int()
        # 记得任何一个输出之后都要 sys.stdout.flush() 刷新
        return res

    def out_put(self, lst):
        # CF交互题输出最终答案
        self.lst(lst)
        sys.stdout.flush()
        return

    @staticmethod
    def accumulate(nums):
        n = len(nums)
        pre = [0] * (n + 1)
        for i in range(n):
            pre[i + 1] = pre[i] + nums[i]
        return pre

    def add(self, x, cnt=1):
        self.dct[x ^ self.seed] = self.dct.get(x ^ self.seed, 0) + cnt
        return

    def rem(self, x, cnt=1):
        self.dct[x ^ self.seed] -= cnt
        return

    def get(self, x):
        return self.dct.get(x ^ self.seed, 0)

    def count(self, lst):
        for num in lst:
            self.add(num, 1)
        return


class UnionFind:
    def __init__(self, n: int) -> None:
        self.root = [i for i in range(n)]
        self.size = [1] * n
        self.part = n
        return

    def find(self, x):
        lst = []
        while x != self.root[x]:
            lst.append(x)
            # 在查询的时候合并到顺带直接根节点
            x = self.root[x]
        for w in lst:
            self.root[w] = x
        return x

    def union(self, x, y):
        root_x = self.find(x)
        root_y = self.find(y)
        if root_x == root_y:
            return False
        if self.size[root_x] >= self.size[root_y]:
            root_x, root_y = root_y, root_x
        self.root[root_x] = root_y
        self.size[root_y] += self.size[root_x]
        # 将非根节点的秩赋0
        self.size[root_x] = 0
        self.part -= 1
        return True

    def is_connected(self, x, y):
        return self.find(x) == self.find(y)

    def get_root_part(self):
        # 获取每个根节点对应的组
        part = defaultdict(list)
        n = len(self.root)
        for i in range(n):
            part[self.find(i)].append(i)
        return part

    def get_root_size(self):
        # 获取每个根节点对应的组大小
        size = defaultdict(int)
        n = len(self.root)
        for i in range(n):
            size[self.find(i)] = self.size[self.find(i)]
        return size


class Solution:
    def __init__(self):
        return

    @staticmethod
    def main(ac=FastIO()):
        n = ac.read_int()
        nums = ac.read_list_ints()
        uf = UnionFind(n)
        res = [1<<i for i in range(32)]
        dct = dict()
        for i in range(n):
            x = nums[i]
            for p in res:
                if (p-x) ^ ac.seed in dct:
                    uf.union(i, dct[(p-x) ^ ac.seed])
            dct[x^ac.seed] = i
        ans = 0
        group = uf.get_root_part()
        for r in group:
            if len(group[r]) == 1:
                ans += 1
        ac.st(ans)
        return


Solution().main()
