There are $n$ distinct points on a coordinate line, the coordinate of $i$-th point equals to $x_i$. Choose a subset of the given set of points such that the distance between each pair of points in a subset is an integral power of two. It is necessary to consider each pair of points, not only adjacent. Note that any subset containing one element satisfies the condition above. Among all these subsets, choose a subset with maximum possible size.

In other words, you have to choose the maximum possible number of points $x_{i_1}, x_{i_2}, \dots, x_{i_m}$ such that for each pair $x_{i_j}$, $x_{i_k}$ it is true that $|x_{i_j} - x_{i_k}| = 2^d$ where $d$ is some non-negative integer number (not necessarily the same for each pair of points).


-----Input-----

The first line contains one integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of points.

The second line contains $n$ pairwise distinct integers $x_1, x_2, \dots, x_n$ ($-10^9 \le x_i \le 10^9$) — the coordinates of points.


-----Output-----

In the first line print $m$ — the maximum possible number of points in a subset that satisfies the conditions described above.

In the second line print $m$ integers — the coordinates of points in the subset you have chosen.

If there are multiple answers, print any of them.


-----Examples-----
Input
6
3 5 4 7 10 12

Output
3
7 3 5
Input
5
-1 2 5 8 11

Output
1
8



-----Note-----

In the first example the answer is $[7, 3, 5]$. Note, that $|7-3|=4=2^2$, $|7-5|=2=2^1$ and $|3-5|=2=2^1$. You can't find a subset having more points satisfying the required property.

Difficulty: introductory

Starter code:

Solutions:
n = int(input())
points = set(int(x) for x in input().strip().split())
powers = [2**i for i in range(31)]

for point in points:
    for power in powers:
        if point + power in points and point + power + power in points:
            print(3)
            print(point, point + power, point + power + power)
            return

for point in points:
    for power in powers:
        if point + power in points:
            print(2)
            print(point, point + power)
            return

print(1)
print(points.pop())


def f():
    k=int(input())
    l=list(map(int,input().split()))
    l=sorted(l)
    d={}
    for i,j in enumerate(l):
        d[j]=i
    n=1
    s=''
    while l[0]+n<=l[-1]:
        for i in l:
            if i+n in d and i+2*n in d:
                print(3)
                print(i,i+n,i+2*n)
                return
            elif i+n in d:
                s=str(i)+' '+str(i+n)
        n=n*2
    if s=='':
        print(1,l[0],sep='\n')
    else:
        print(2,s,sep='\n')
        

f()
                


import sys
n=int(input())
L=sorted(list(map(int,input().split())))
dic=dict()
ss=set(L)
ans=[L[0]]
for i in range(n):
    for j in range(32):
        t=(1<<j)+L[i]
        if t in ss:
            ans=[L[i],t]
            if t+(1<<j) in ss:
                print(3)
                print(L[i],t,t+(1<<j))
                return
print(len(ans))
for i in ans:
    print(i,end=" ")
print()
            
            
            
        


def is_power2(num):
	return ((num & (num - 1)) == 0)


def maybeAdd(dot, peers):
    for peer in peers:
        if not is_power2(abs(dot - peer)):
            return False
    peers.append(dot)

n = int(input())
dots = list(map(int, input().split()))
m = min(dots)
M = max(dots)

l = {}
for dot in dots:
    l[dot] = True

ans = []
att = []

for dot in dots:
    att = [dot]
    maxpow = max(abs(dot - m), abs(dot - M)).bit_length()

    diff = 1
    for pow in range(maxpow):
        if dot - diff in l:
            maybeAdd(dot - diff, att)
        if dot + diff in l:
            maybeAdd(dot + diff, att)
        diff *= 2

    if len(att) > len(ans):
        ans = att

print(len(ans))
print(*ans)


#!/usr/bin/env python3
from sys import stdin, stdout

def rint():
    return list(map(int, stdin.readline().split()))
#lines = stdin.readlines()

n = int(input())

x = set(rint())
x_list = list(x)
x_list.sort()
#print(x)
#print(x_list)
max_len = 1
for i in range(len(x_list)):
    start = x_list[i]
    for j in range(0, 1000):
        candidate = [start]
        next = start + 2**j
        if next > x_list[-1]:
            break
        if next in x:
            candidate.append(next)
            next = start + 2**(j+1)
            if next in x:
                candidate.append(next)
                print(3)
                print(*candidate)
                return
            else:
                ans = candidate
                max_len = 2

if max_len == 2:
    print(2)
    print(*ans)
else:
    print(1)
    print(x_list[0])






n = int(input())
*a, = list(map(int, input().split()))

s = set(a)

def solve(x, s):
	p = 1
	ret = [x]
	for d in range(32):
		if x + p in s:
			if x + 2 * p in s:
				return [x, x + p, x + 2 * p]
			if x - p in s:
				return [x - p, x, x + p]
			ret = [x, x + p]
		elif x - p in s:
			if x - 2 * p in s:
				return [x - 2 * p, x - p, x]
			ret = [x - p, x]
		p *= 2
	return ret

best = []
for x in a:
	bestx = solve(x, s)
	if len(bestx) > len(best):
		best = bestx
print(len(best))		
print(' '.join(map(str, best)))







n = int(input())
a = []
_2 = [1]

FS = lambda x : x in S

def F(x):
   l,r=0,len(a)-1
   while l<r-1 :
      mid = (l+r)>>1
      if a[mid]==x :
         return True
      elif a[mid]<x:
         l = mid+1
      else :
         r = mid-1
   else :
      return a[l]==x or a[r]==x



for i in range(30):
   _2.append(_2[i]*2)
#for i in _2:
#   print(i)

for i in map(int,input().split()):
   a.append(i)
#a.sort()
S = set(a)
#for i in a:
#   print(i)


ans = 1
A = [0,a[0],0]

for i in a:
   if ans == 3 :
      break
   for j in _2:
      if ans == 3:
         break;
      if FS(i-j) :
         if ans<=2 :
            ans = 2
            A[0] = i-j
            A[1] = A[2] = i
         if FS(i+j):
            ans = 3
            A[2] = i+j
 #           print("ans is ",i,j)
            break
print(ans)
if(ans==3):
   print(*A)
else :
   print(A[1],end=" ")
   if(ans==2):
      print(A[0]+A[2]-A[1])
   else :
      print()


n = int(input())

num = sorted(map(int, input().strip().split()))

powers_of_2 = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824]

num_dict = {}
for i in range(n):
	num_dict[num[i]] = num[i]

flag_two = False
flag_three = False

twos = []
threes = []

for i in range(n):
	curr = num[i]
	for power in powers_of_2:
		if(num_dict.get(curr + power) is not None):
			flag_two = True
			twos = []
			twos.append(curr)
			twos.append(curr + power)

			if(num_dict.get(curr + 2*power) is not None):
				flag_three = True
				threes = []
				threes.append(curr)
				threes.append(curr + power)
				threes.append(curr + 2*power)
				break

	if(flag_three):
		break

if(flag_three):
	print("3")
	print(" ".join(map(str, threes)))

elif(flag_two):
	print("2")
	print(" ".join(map(str, twos)))

else:
	print("1")
	print(num[0])


n = int(input())
n1 = input().split()

n2 = []
s1 = set()
for x in n1:
	n2.append(int(x))
	s1.add(int(x))

n2.sort()

maxy = n2[len(n2)-1]-n2[0]

count = 0
num = 1

while(num<maxy):
	num = num*2
	count = count + 1

flag = 0
base0 = 0
base1 = 0
base2 = -1

cflag = 0

for x in n2:
	for z in range(0, count+1):
		# print(z)
		if(x+2**z in s1):
			if(flag==0):
				flag = 1
				base0 = x
				base1 = x+2**z
			if(x+2**(z+1) in s1):
				cflag = 1
				base0 = x
				base1 = x+2**z
				base2 = x+2**(z+1)
				break
	if(cflag==1):
		break

if(cflag==1):
	s = "3\n" + str(base0) + " " + str(base1) + " " + str(base2)
	print(s)
if(cflag==0 and flag==1):
	s = "2\n" + str(base0) + " " + str(base1)
	print(s)
if(cflag==0 and flag==0):
	s = "1\n" + str(n2[0])
	print(s)

st = set([])
n = int(input())
arr = map(int, input().split())
maxn = int(1e9) 
ans = 0
lol1 = lol2 = 0

for i in arr:
  st.add(i)
for i in st:
  p = 1
  while i+p<=maxn:
    if i+p in st:
      if i+p+p in st:
        print(3)
        print(i, end = " ")
        print(i+p, end = " ")
        print(i+p+p)
        return
      else:
        ans = 2
        lol1 = i
        lol2 = i + p
    p *= 2
if ans == 2:
  print(2)
  print(lol1, end = " ")
  print(lol2)
else:
  print(1)
  print(st.pop())

n = int(input())
a = [int(s) for s in input().split(' ')]

best_m = 1
best_res = []
best_res.append(a[0])

powers = []
for i in range(31):
    powers.append(2 ** i)

s = set()
for i in range(n):
    s.add(a[i])

for i in range(n):
    if best_m == 3:
        break
    x = a[i]
    for p in range(31):
        d = powers[p]
        if ((x - d) in s) and ((x + d) in s):
            best_m = 3
            best_res = [x - d, x, x + d]
            break
        if best_m >= 2:
            continue
        if ((x - d) in s):
            best_m = 2
            best_res = [x - d, x]
            continue

        if ((x + d) in s):
            best_m = 2
            best_res = [x, x + d]
            continue

print(best_m)
print(" ".join([str(x) for x in best_res]))

n = int(input())
a = [int(x) for x in input().split()]
a = sorted(a)
flag = 0
import bisect
for i in range(0,n):
    for j in range(0,31):
        b = a[i] + 2**j
        p = bisect.bisect_left(a,b)
        if p < n:
            if a[p] == b:
                a1 = a[i]
                b1 = b
                flag = 100
                c = a[i] + 2*2**j
                q = bisect.bisect_left(a,c)
                if q < n:
                    if a[q] == c:
                        flag = 200
                        break
    if flag == 200:
        break
if flag == 0:
    print(1)
    print(a[0])
elif flag == 100:
    print(2)
    print(a1,b1)
else:
    print(3)
    print(a[i],b,c)

n = int(input())
listNum = sorted(list(map(int, input().split())))
setNum = set(listNum)
powTwo = list([2**x for x in (list(range(0, 32)))])
found2 = False
found3 = False
res = [0, 0, 0]
for powNum in powTwo:
  for num in listNum:
    if (found3):
        break
    if (num + powNum) in setNum:
      found2 = True
      if (found3 == False):
        res[0] = num
        res[1] = num + powNum
      if num + 2*powNum in setNum:
        found3 = True
        res[0] = num
        res[1] = num + powNum
        res[2] = num + 2 * powNum
if (found3):
    print(3)
    print(res[0], res[1], res[2])
elif (found2):
    print(2)
    print(res[0], res[1])
else:
    print(1)
    print(listNum[0])


n = int(input())

num = sorted(map(int, input().strip().split()))

powers_of_2 = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824]

num_dict = {}
for i in range(n):
	num_dict[num[i]] = num[i]

flag_two = False
flag_three = False

twos = []
threes = []

for i in range(n):
	curr = num[i]
	for power in powers_of_2:
		if(num_dict.get(curr + power) is not None):
			flag_two = True
			twos = []
			twos.append(curr)
			twos.append(curr + power)

			if(num_dict.get(curr + 2*power) is not None):
				flag_three = True
				threes = []
				threes.append(curr)
				threes.append(curr + power)
				threes.append(curr + 2*power)
				break

	if(flag_three):
		break

if(flag_three):
	print("3")
	print(" ".join(map(str, threes)))

elif(flag_two):
	print("2")
	print(" ".join(map(str, twos)))

else:
	print("1")
	print(num[0])


visit=dict()
exist=dict()
n=int(input())
x=sorted(map(int,input().split()))
limit=max(x)
for n,i in enumerate(x): exist[i]=n+1
ans,ans2=1,[x[0]]
for i in range(len(x)):
  if visit.get(x[i],0): continue
  j=1
  while x[i]+j<=limit:
    visit[x[i]+j]=True
    if exist.get(x[i]+j,0):
      if ans==1:
        ans=2
        ans2=[x[i],x[i]+j]
      if j!=1 and exist.get(x[i]+j//2,0):
        print(3)
        print(x[i]+j,x[i],x[i]+j//2)
        return
    j*=2

if ans==2:
  print(2)
  print(ans2[0],ans2[1])
else:
  print(1)
  print(x[0])

n = int(input())
nums = list(map(int, input().split(' ')))

nums = sorted(nums)

power = [2**i for i in range(33)]


def search(x):
    low = 0
    high = len(nums)

    while low < high-1:
        mid =  (low+high)//2
        if x > nums[mid]:
            low = mid
        elif x < nums[mid]:
            high = mid
        elif x == nums[mid]:
            return x
    return None



best = []
for i in power:

    for j in nums:
        result = []
        result.append(j)
        if search(j + i) is not None:
            result.append(j + i)
        if search(j + 2*i) is not None:
            result.append(j + 2*i)

        if len(result) > len(best):
            best = result




print(len(best))
print(' '.join(map(str, best)))





def main():
	t = int(input())
	a = [int(x) for x in input().split()]
	p2 = [2**i for i in range(32)]
	dic = {}
	for e in a:
		dic[e] = 1
	a.sort()
	ans = []
	for i in a:
		for j in p2:
			if dic.get(i+j):
				if not ans:
					ans = [i,i+j]
				if dic.get(i+j*2):
					print(3)
					print(i,i+j,i+j*2)
					return
	if ans:
		print(2)
		print(ans[0],ans[1])
	else:
		print(1)
		print(a[0])
def __starting_point():
	main()

__starting_point()

n=int(input())
a=set(map(int,input().split()))
ans=[]
f=0
for i in a:
    c=1
    for p in range(31):
        if(i+c in a):
            ans=[i,i+c]
            if(i+c*2 in a):
                print(3)
                print(i,i+c,i+c*2)
                f=1
                break
        c*=2
    if(f):
        break
if(f==0):
    if(ans):
        print(2)
        print(*ans)
    else:
        print(1)
        print(min(a))

n=int(input())
a=(set(map(int,input().split())))
ans=[]
f=0
for i in a:
    c=1
    for p in range(31):
        if(i+c in a):
            ans=[i,i+c]
            if(i+c*2 in a):
                print(3)
                print(i,i+c,i+c*2)
                f=1
                break
        c*=2
    if(f):
        break
if(f==0):
    if(ans):
        print(2)
        print(*ans)
    else:
        print(1)
        print(min(a))


n=int(input())
s=set(map(int,input().split()))
m=max(s)
p=0
for x in s:
 d=1
 while x+d<=m:
  y=x+d
  if y in s:
   p=x,y
   if y+d in s:
    print(3);print(x,y,y+d);return
  d*=2
if p:
 print(2);print(*p)
else:print('1\n'+str(m))

def check(n,numsDone):
	currDist = 1
	currLen = 1
	currAns = [n]
	while (n + currDist <= 10**9) or (n - currDist >= -10**9):
		if (n+currDist) in numsDone and (n-currDist) in numsDone:
			currLen = 3
			currAns = [n-currDist,n,n+currDist]
			break
		elif (n+currDist) in numsDone:
			currLen = 2
			currAns = [n,n+currDist]
		elif (n-currDist) in numsDone:
			currLen = 2
			currAns = [n-currDist,n]
		currDist = currDist << 1
	return currAns


n = int(input())
nums = list(map(int, input().split()))
currLen = 1
currAns = [nums[0]]
numsDone = set(nums)

for i in nums:
	temp = check(i,numsDone)
	# print(i)
	# print(temp)
	if len(temp) > currLen:
		currLen = len(temp)
		currAns = temp
	if len(temp) == 3:
		break

print(currLen)
print(*currAns)

from bisect import bisect as bs
t = [0] * int(input())
a = sorted(map(int, input().split()))
g = lambda x: a[bs(a, x) - 1] == x
for _, x in enumerate(a):
    for i in range(31):
        l = x - 2 ** i
        r = x + 2 ** i
        t[_] = max(t[_], g(l) + g(r))
m = max(t)
if m == 2:
    print(3)
    _ = t.index(2)
    x = a[_]
    for i in range(31):
        l = x - 2 ** i
        r = x + 2 ** i
        if g(l) and g(r):
            print(l, x, r)
            return
if m == 1:
    print(2)
    _ = t.index(1)
    x = a[_]
    for i in range(31):
        l = x - 2 ** i
        r = x + 2 ** i
        if g(l):
            print(l, x)
            return
        if g(r):
            print(x, r)
            return
print(1)
print(a[0])


import sys
n=int(input())
s=list(map(int,input().split()))
st=set()
for i in s:
    st.add(i)
p=set()
pw=[]
for i in range(31):
    p.add(2**i)
    pw.append(2**i)
for i in range(n):
    for j in range(len(pw)):
        if s[i]+pw[j] in  st:
            if s[i]-pw[j] in st:
                print(3)
                print(s[i]-pw[j] ,s[i],s[i]+pw[j])
                return
            if s[i]+pw[j]+pw[j] in st:
                print(3)
                print(s[i],s[i]+pw[j] ,s[i]+pw[j]+pw[j])
                return
        if s[i]-pw[j] in  st:
            if s[i]+pw[j] in st:
                print(3)
                print(s[i]-pw[j] ,s[i],s[i]+pw[j])
                return
            if s[i]-pw[j]-pw[j] in st:
                print(3)
                print(s[i],s[i]-pw[j] ,s[i]-pw[j]-pw[j])
                return
for i in range(n):
    for j in range(len(pw)):
        if s[i]+pw[j] in  st:
            print(2)
            print(s[i],s[i]+pw[j])
            return
        if s[i]-pw[j] in  st:
            print(2)
            print(s[i],s[i]-pw[j])
            return
print(1)
print(s[0])


n=int(input())
ar=set(map(int,input().split()))

Max = max(ar)
ans=()
flag=0
for i in ar:
    j=1
    while i+j<=Max:
        if i+j in ar:
            ans=(i,i+j)
            flag=1
            if i+2*j in ar:
                print("3")
                print(i,i+j,i+2*j)
                return
        j*=2
if flag==1:
    print("2")
    print(*ans)
else:
    print("1")
    print(Max)

def read_numbers():
  return (int(s) for s in input().strip().split(' '))

# keys_set = {128, 1, 2, 256, 4, 512, 1024, 2048, 8, 4096, 32768, 131072, 524288, 262144, 8192, 1048576, 16, 16384, 4194304, 32, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 64, 65536, 2097152}
# keys = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824]
keys = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824]

def main():
  _ = input()
  dots = set(read_numbers())
  # print(keys)
  # print(dots)

  max_res = []

  for dot in dots:
    for dist in keys:
      res = [dot]
      d1 = dot - dist
      d2 = dot + dist
      if d1 in dots:
        res.append(d1)
      if d2 in dots:
        res.append(d2)
      
      if len(res) > len(max_res):
        max_res = res
      
      if len(max_res) == 3:
        print(len(max_res))
        print(' '.join(str(n) for n in max_res))
        return

  print(len(max_res))
  print(' '.join(str(n) for n in max_res))
  


def __starting_point():
  main()
__starting_point()