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: MEDIUM_HARD

Solutions:
import sys
import math
import collections
import heapq
input = sys.stdin.readline
n = int(input())
l = sorted([int(i) for i in input().split()])
l1 = []
p = 1
j = 0
while j < 31:
	l1.append(p)
	p *= 2
	j += 1
d = collections.Counter(l)
t = []
c = 0
for i in d:
	c1 = 0
	for j in range(31):
		if i + l1[j] in d and i + 2 * l1[j] in d:
			k1 = l1[j]
			c1 = 1
			break
	if c1 == 1:
		t = [i, i + k1, i + 2 * k1]
		c = 1
		break
if c == 0:
	c1 = 0
	for i in d:
		for j in range(31):
			if i + l1[j] in d:
				k1 = l1[j]
				c1 = 1
				break
		if c1 == 1:
			t = [i, i + k1]
			c = 1
			break
	if c == 0:
		print(1)
		print(l[0])
	else:
		print(2)
		print(*t)
else:
	print(3)
	print(*t)


import math
n = int(input())
xi = list(map(int, input().split()))
setli = set(xi)
ans = 1
twos = []
three = []
for i in xi:
	if ans == 3:
		break
	li = []
	for ii in range(0, 35):
		if i + 2 ** ii in setli:
			ans = max(ans, 2)
			li.append((i, ii))
			if len(li) > 1:
				if li[-2][1] == ii - 1:
					ans = max(ans, 3)
					three.append((i, ii - 1, ii))
					break
	if len(li) != 0:
		twos.append(li)
print(ans)
if ans == 1:
	print(xi[0])
elif ans == 2:
	print(twos[0][0][0], twos[0][0][0] + 2 ** twos[0][0][1])
elif ans == 3:
	print(three[0][0], three[0][0] + 2 ** three[0][1], three[0][0] + 2 ** three[0][2])


n = int(input())
li = list(map(int, input().split()))
lis = set(li)
p = [2 ** i for i in range(40)]
x = None
for i in lis:
	c = 0
	ind = 0
	for j in range(35):
		ss = i + p[j]
		if ss in lis:
			if ind != 0:
				print('3')
				print(i, c, ss)
				exit()
			if not x:
				x = (i, ss)
			ind = 1
			c = ss
		else:
			ind = 0
if x:
	print('2')
	print(x[0], x[1])
else:
	print('1')
	print(li[0])


from functools import cmp_to_key
import sys

def getIntList():
	return list(map(int, input().split()))
n = int(input())
nz = getIntList()
ns = set(nz)
r2 = None
pow2 = [2 ** i for i in range(40)]
for x in ns:
	last = 0
	flag = False
	for i in range(32):
		t = x + pow2[i]
		if t in ns:
			if flag:
				print(3)
				print(x, last, t, sep=' ')
				sys.exit()
			if not r2:
				r2 = (x, t)
			flag = True
			last = t
		else:
			flag = False
if r2:
	print(2)
	print(r2[0], r2[1])
else:
	print(1)
	print(nz[0])


pow2 = dict()
curr = 1
z = 10 ** 9
while curr < 2 * z + 5:
	pow2[curr] = 1
	curr = curr * 2
n = int(input())
l = input().split()
li = [int(i) for i in l]
hashi = dict()
for i in li:
	hashi[i] = 1
done = 0
for i in pow2:
	for j in li:
		if j + i in hashi and j + 2 * i in hashi:
			print(3)
			print(j, j + i, j + 2 * i)
			done = 1
			quit()
for i in pow2:
	for j in li:
		if j + i in hashi:
			print(2)
			print(j, j + i)
			done = 1
			quit()
print(1)
print(li[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)))


from sys import stdin

def bin_search(A, val) -> int:
	left_b = 0
	right_b = len(A) - 1
	while left_b < right_b:
		mid = left_b + right_b >> 1
		if A[mid] > val:
			right_b = mid - 1
		elif A[mid] < val:
			left_b = mid + 1
		else:
			return mid
	ans = right_b if A[right_b] == val else -1
	return ans

def print_ans(ans) -> None:
	print(len(ans))
	print(*ans)

def main() -> None:
	n = int(input())
	A = [int(i) for i in stdin.readline().split()]
	A.sort()
	max_gap = abs(A[-1] - A[0])
	if max_gap == 0:
		max_gap = 1
	ans = []
	gap = 1
	temp = []
	while gap <= max_gap:
		for a in A:
			temp = []
			temp.append(a)
			b = a + gap
			c = b + gap
			if bin_search(A, b) != -1:
				temp.append(b)
			if bin_search(A, c) != -1:
				temp.append(c)
			ans = max(ans, temp, key=len)
			if len(ans) == 3:
				print_ans(ans)
				return
		gap <<= 1
	print_ans(ans)
main()


n = int(input())
x = list(map(int, input().split()))
powers = [2 ** i for i in range(31)]
ca = []
d = {}
for i in x:
	d[i] = 1
for i in d:
	for j in powers:
		if i + j in d:
			if len(ca) == 0:
				ca = [i, i + j]
			if i + j + j in d:
				print(3)
				print(i, i + j, i + j + j)
				exit()
if len(ca) > 1:
	print(2)
	print(ca[0], ca[1])
	exit()
print(1)
print(x[0])


from collections import defaultdict, Counter
from bisect import bisect, bisect_left
from math import sqrt, gcd

def read():
	return list(map(int, input().strip().split()))
ans_ = []
t_p = [2 ** i for i in range(31)]
n = int(input())
arr = Counter(read())
d = defaultdict(int)
m = 1
ans_lis = [list(arr.keys())[0]]
for i in arr:
	for j in t_p:
		(a, b, c) = (i, i + j, i + 2 * j)
		s = (arr[a] > 0) + (arr[b] > 0) + (arr[c] > 0)
		if s > m:
			m = s
			ans_lis = [x for x in [a, b, c] if arr[x]]
ans_.append(m)
t = ''
for i in ans_lis:
	t += str(i) + ' '
ans_.append(t)
for i in ans_:
	print(i)


n = int(input())
arr = [int(j) for j in input().split()]
arr.sort()
ans = [arr[0]]
ma = [1, ans]
arr = set(arr)
for x in arr:
	two = 1
	while x + two < 10 ** 10:
		if x + two in arr:
			ans = [x, x + two]
			if ma[0] < 2:
				ma = [2, ans]
			if x + 2 * two in arr:
				ans = [x, x + two, x + 2 * two]
				if ma[0] < 3:
					ma = [3, ans]
			two *= 2
		else:
			two *= 2
print(ma[0])
print(*ma[1])


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
from bisect import bisect, bisect_left
from time import time
from itertools import permutations as per
from heapq import heapify, heappush, heappop, heappushpop
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\r\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
lcm = lambda x, y: x * y // gcd(x, y)
nCr = lambda x, y: f[x] * inv(f[y] * f[x - y] % N) % N
inv = lambda x: pow(x, N - 2, N)
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
n = I()
a = sorted(R())
d = defaultdict(int)
for i in a:
	d[i] = 1
mx = max(a)
ans = [a[0]]
ln = 1
for i in a:
	p = 1
	b = [i]
	x = 1
	while i + x <= mx:
		if d[i + x]:
			p += 1
			b += (i + x,)
		else:
			p = 1
			b = [i]
		if p > ln:
			ln = p
			ans = b.copy()
		if ln == 3:
			print(ln)
			print(*ans)
			exit()
		x <<= 1
print(ln)
print(*ans)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
from collections import deque
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	n = int(input())
	a = list(map(int, input().split()))
	s = set(a)
	a.sort()
	ans = []
	for i in range(n):
		for j in range(31):
			tmp = [a[i]]
			x = a[i] + 2 ** j
			y = a[i] + 2 ** (j + 1)
			if x in s:
				tmp.append(x)
			if y in s:
				tmp.append(y)
			if len(tmp) > 1:
				if len(ans) == 0:
					ans.append(tmp)
				elif len(tmp) > len(ans[0]):
					ans[0] = tmp
	if len(ans) == 0:
		print(1)
		print(a[0])
		return
	if len(ans[0]) == 2:
		print(2)
		print(ans[0][0], ans[0][1])
		return
	if len(ans[0]) == 3:
		print(3)
		print(ans[0][0], ans[0][1], ans[0][2])
		return
main()


N = int(input())
s = list(map(int, input().split()))
s.sort()
d = {}
for x in s:
	d[x] = 1
i = 1
ans = []
while i < 1e+18:
	for x in s:
		t = []
		if d.get(x + i, 0) == 1:
			t = [x, x + i]
		if d.get(x + 2 * i, 0) == 1:
			t.append(x + 2 * i)
		if len(t) > len(ans):
			ans = t
		if len(ans) == 3:
			print(3)
			print(*ans)
			exit(0)
	i *= 2
if len(ans) < 2:
	ans = [s[0]]
print(len(ans))
print(*ans)


import sys

def solve(io):
	N = io.readInt()
	X = io.readIntArray(N)
	has = set(X)
	best = (X[0],)
	for v in X:
		for b in range(0, 31):
			p = 1 << b
			a = v + p
			if a in has:
				if len(best) < 2:
					best = (v, a)
				b = a + p
				if b in has and len(best) < 3:
					best = (v, a, b)
					break
	io.println(len(best))
	io.printlnArray(best)

class IO:
	input = None
	output = None

	def __init__(self, inputStream, outputStream):
		self.input = inputStream
		self.output = outputStream

	@staticmethod
	def isSpaceChar(c):
		return c == ' ' or c == '\n' or c == '\x00' or (c == '\r') or (c == '\t')

	@staticmethod
	def isLineBreakChar(c):
		return c == '\n' or c == '\x00' or c == '\r'

	def readChar(self):
		return self.input.read(1)

	def readString(self):
		c = self.readChar()
		while IO.isSpaceChar(c):
			c = self.readChar()
		sb = []
		while not IO.isSpaceChar(c):
			sb.append(c)
			c = self.readChar()
		return ''.join(sb)

	def readLine(self):
		c = self.readChar()
		while IO.isSpaceChar(c):
			c = self.readChar()
		sb = []
		while not IO.isLineBreakChar(c):
			sb.append(c)
			c = self.readChar()
		return ''.join(sb)

	def readInt(self):
		c = self.readChar()
		while IO.isSpaceChar(c):
			c = self.readChar()
		sgn = 1
		if c == '-':
			sgn = -1
			c = self.readChar()
		res = 0
		while not IO.isSpaceChar(c):
			res = res * 10 + ord(c) - 48
			c = self.readChar()
		return sgn * res

	def readFloat(self):
		return float(self.readString())

	def readStringArray(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.readString())
		return arr

	def readIntArray(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.readInt())
		return arr

	def readFloatArray(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.readFloat())
		return arr

	def print(self, s):
		self.output.write(str(s))

	def println(self, s):
		self.print(s)
		self.print('\n')

	def printlnArray(self, arr, sep=' '):
		self.println(sep.join((str(x) for x in arr)))

	def flushOutput(self):
		self.output.flush()
pythonIO = IO(sys.stdin, sys.stdout)
solve(pythonIO)
pythonIO.flushOutput()


n = int(input())
a = list(map(int, input().split()))
b = set(a)
e = []
for i in range(n):
	c = [a[i]]
	for j in range(35):
		d = []
		p = a[i]
		d.append(p)
		q = 2 ** j
		for k in range(2):
			if p + q in b:
				p = p + q
				d.append(p)
		if len(d) > len(c):
			c = d
	e.append(c)
p = e[0]
for i in e:
	if len(i) > len(p):
		p = i
print(len(p))
print(*p)


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])


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):
		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)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
N = int(input())
s = list(map(int, input().split()))
s.sort()
d = {}
for x in s:
	d[x] = 1
i = 1
ans = []
while i < 1e+18:
	for x in s:
		t = []
		if d.get(x + i, 0) == 1:
			t = [x, x + i]
		if d.get(x + 2 * i, 0) == 1:
			t.append(x + 2 * i)
		if len(t) > len(ans):
			ans = t
		if len(ans) == 3:
			print(3)
			print(*ans)
			exit(0)
	i *= 2
if len(ans) < 2:
	ans = [s[0]]
print(len(ans))
print(*ans)


import sys

def solve(io):
	N = io.readInt()
	X = io.readIntArray(N)
	has = set(X)
	best = (X[0],)
	for v in X:
		for b in range(0, 31):
			p = 1 << b
			a = v + p
			if a in has:
				if len(best) < 2:
					best = (v, a)
				b = a + p
				if b in has and len(best) < 3:
					best = (v, a, b)
					break
	io.println(len(best))
	io.printlnArray(best)

class IO:
	input = None
	output = None
	raw = ''
	buf = []
	pos = 0

	def __init__(self, inputStream, outputStream):
		self.input = inputStream
		self.output = outputStream

	def readToBuffer(self):
		self.raw = self.input.readline().rstrip('\n')
		self.buf = self.raw.split()
		self.pos = 0

	def readString(self):
		while self.pos == len(self.buf):
			self.readToBuffer()
		ans = self.buf[self.pos]
		self.pos += 1
		return ans

	def readInt(self):
		return int(self.readString())

	def readFloat(self):
		return float(self.readString())

	def readStringArray(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.readString())
		return arr

	def readIntArray(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.readInt())
		return arr

	def readFloatArray(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.readFloat())
		return arr

	def readLine(self):
		while self.pos == len(self.buf):
			self.readToBuffer()
		if self.pos > 0:
			raise ValueError('Cannot call readline in the middle of a line.')
		return self.raw

	def print(self, s):
		self.output.write(str(s))

	def println(self, s):
		self.print(s)
		self.print('\n')

	def printlnArray(self, arr, sep=' '):
		self.println(sep.join((str(x) for x in arr)))

	def flushOutput(self):
		self.output.flush()
pythonIO = IO(sys.stdin, sys.stdout)
solve(pythonIO)
pythonIO.flushOutput()


n = int(input())
arr = sorted(list(map(int, input().split())))
d = {}
for i in range(n):
	d[arr[i]] = i
ans = 0
ans_diff = 0
curr = 1
while curr <= 3 * 10 ** 9:
	markings = [0 for _ in range(n)]
	for t in range(n):
		if markings[t] == 0:
			count = 1
			x = t
			while arr[x] + curr in d.keys() and count < 3:
				x = d[arr[x] + curr]
				count += 1
			if count > ans:
				ans = max(ans, count)
				ans_diff = [t, curr]
	curr = curr * 2
print(min(3, ans))
count = 0
while count < ans and count < 3:
	print(arr[ans_diff[0]] + count * ans_diff[1], end=' ')
	count += 1
print('')


def pows2(n):
	p2 = 1
	while p2 <= n:
		yield p2
		p2 <<= 1

def maxseq(l, d):
	prev = -float('inf')
	best = []
	curr = []
	for v in l:
		if v - prev != d:
			curr = []
		curr.append(v)
		prev = v
		if len(best) < len(curr):
			best = curr
	return best
n = int(input())
x = sorted(map(int, input().split()))
ans = []
for p2 in pows2(max(x) - min(x) + 1):
	y = {}
	for v in x:
		vs = v % p2
		if vs not in y or len(y[vs]) >= 3 or v - y[vs][-1] != p2:
			y[vs] = []
		y[vs].append(v)
		ans = max(ans, y[vs], key=len)
print(len(ans))
print(*ans)


from collections import defaultdict
(n, a) = (int(input()), [int(x) for x in input().split()])
pow2 = [1 << i for i in range(32)]
mp = defaultdict()
for x in a:
	mp[x] = 1
mxSiz = 1
ans = [a[0]]
for x in a:
	for y in pow2:
		if x - y in mp and x + y in mp:
			mxSiz = 3
			ans = [x - y, x, x + y]
		if x - y in mp and 2 > mxSiz:
			mxSiz = 2
			ans = [x - y, x]
print(mxSiz)
print(*ans)


import sys
input = sys.stdin.readline
n = int(input())
x = list(map(int, input().split()))
x.sort()
sx = set(x)
k = 1
ml = 1
ans = [x[0]]
for j in range(31):
	for xx in x:
		if xx - k in sx:
			if ml == 1:
				ml = 2
				ans = [xx - k, xx]
		if xx + k in sx:
			if ml == 1:
				ml = 2
				ans = [xx, xx + k]
		if xx - k in sx and xx + k in sx and (ml <= 2):
			ml = 3
			ans = [xx - k, xx, xx + k]
	k *= 2
print(ml)
print(*ans)


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()


import sys
input = sys.stdin.readline
n = int(input())
ar = list(map(int, input().split()))
ar.sort()
se = set(ar)
li = []
st = 1
for i in range(32):
	li.append(st)
	st <<= 1
ans = 1
br = [ar[0]]
for i in ar:
	for j in li:
		if i + j in se:
			if ans < 2:
				ans = 2
				br = [i, i + j]
			if i + 2 * j in se:
				if ans < 3:
					ans = 3
					br = [i, i + j, i + 2 * j]
print(ans)
print(*br)