Limak is a little polar bear. He has n balls, the i-th ball has size t_{i}.

Limak wants to give one ball to each of his three friends. Giving gifts isn't easy — there are two rules Limak must obey to make friends happy:  No two friends can get balls of the same size.  No two friends can get balls of sizes that differ by more than 2. 

For example, Limak can choose balls with sizes 4, 5 and 3, or balls with sizes 90, 91 and 92. But he can't choose balls with sizes 5, 5 and 6 (two friends would get balls of the same size), and he can't choose balls with sizes 30, 31 and 33 (because sizes 30 and 33 differ by more than 2).

Your task is to check whether Limak can choose three balls that satisfy conditions above.


-----Input-----

The first line of the input contains one integer n (3 ≤ n ≤ 50) — the number of balls Limak has.

The second line contains n integers t_1, t_2, ..., t_{n} (1 ≤ t_{i} ≤ 1000) where t_{i} denotes the size of the i-th ball.


-----Output-----

Print "YES" (without quotes) if Limak can choose three balls of distinct sizes, such that any two of them differ by no more than 2. Otherwise, print "NO" (without quotes).


-----Examples-----
Input
4
18 55 16 17

Output
YES

Input
6
40 41 43 44 44 44

Output
NO

Input
8
5 972 3 4 1 4 970 971

Output
YES



-----Note-----

In the first sample, there are 4 balls and Limak is able to choose three of them to satisfy the rules. He must must choose balls with sizes 18, 16 and 17.

In the second sample, there is no way to give gifts to three friends without breaking the rules.

In the third sample, there is even more than one way to choose balls:  Choose balls with sizes 3, 4 and 5.  Choose balls with sizes 972, 970, 971.

Difficulty: EASY

Solutions:
n = int(input())
balls = list(map(int, input().split()))
balls.sort()

def answer(balls):
	a = 0
	b = 1
	while b < len(balls) - 1:
		while balls[b] == balls[a] and b < len(balls) - 2:
			b += 1
		if balls[b] == balls[a] + 1:
			c = b + 1
			while balls[c] == balls[b] and c < len(balls) - 1:
				c += 1
			if balls[c] == balls[b] + 1:
				return 'YES'
			else:
				a = c
				b = a + 1
		else:
			a = b
			b = a + 1
	return 'NO'
print(answer(balls))


def solve(arr, n):
	arr.sort()
	for i in range(n - 2):
		for j in range(i + 1, n - 1):
			for k in range(j + 1, n):
				if arr[i] != arr[j] != arr[k] and arr[k] - arr[i] <= 2:
					return True
	return False
n = int(input())
arr = list(map(int, input().split()))
if solve(arr, n):
	print('YES')
else:
	print('NO')


n = int(input())
l = input().split()
l = [int(i) for i in l]
l.sort()
c = 1
m = []
for i in l:
	if i not in m:
		m.append(i)
for i in range(len(m) - 2):
	if m[i + 2] - m[i] == 2 and m[i + 1] - m[i] == 1:
		c = 0
		break
if c == 0:
	print('YES')
else:
	print('NO')


n = int(input())
l = sorted(set(map(int, input().split())))
if len(l) < 3:
	print('NO')
else:
	for i in range(len(l) - 2):
		if l[i] + 2 == l[i + 1] + 1 == l[i + 2]:
			ans = 'YES'
			break
		else:
			ans = 'NO'
	print(ans)


def remove_duplicates(values):
	return list(set(values))
n_balls = int(input())
balls = list(map(int, input().split()))
balls = remove_duplicates(balls)
balls.sort()
happy = False
for i in range(0, len(balls) - 2):
	if balls[i] + 1 == balls[i + 1]:
		if balls[i] + 2 == balls[i + 2]:
			happy = True
			break
if happy:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a = sorted(list(set(a)))
c = 0
for i in range(len(a) - 2):
	if a[i] + 1 == a[i + 1] and a[i + 1] + 1 == a[i + 2]:
		c = 1
if c == 1:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
x = set(a)
a.clear()
for i in x:
	a.append(i)
a.sort()
for i in range(2, len(a)):
	if abs(a[i] - a[i - 1]) <= 2 and abs(a[i] - a[i - 2]) <= 2 and (abs(a[i - 1] - a[i - 2]) <= 2) and (a[i] != a[i - 1]) and (a[i] != a[i - 2]) and (a[i - 1] != a[i - 2]):
		print('YES')
		exit(0)
print('NO')


def main():
	input()
	a = list(map(int, input().split()))
	a = list(set(a))
	a.sort()
	flag = False
	n = len(a)
	for i in range(n - 2):
		if a[i] + 1 == a[i + 1] and a[i + 1] + 1 == a[i + 2]:
			print('YES')
			flag = True
			break
	if not flag:
		print('NO')
main()


count = int(input())
temp = input().split(' ')
sizes = [int(x) for x in temp]
sizes.sort()

def check(l):
	if len(l) >= 3:
		if l[2] - l[1] == 1 and l[1] - l[0] == 1:
			return True
		elif l[2] == l[1]:
			return check(l[:1] + l[2:])
		else:
			return check(l[1:])
	return False
if check(sizes):
	print('YES')
else:
	print('NO')


n = int(input())
balls = sorted(set(map(int, input().split())))
print(('NO', 'YES')[any((y - x <= 2 for (x, y) in zip(balls[:-2], balls[2:])))])


n = int(input())
l = set(map(int, input().split()))
d = {}
o = 'NO'
for n in l:
	c = 0
	d = False
	for m in l:
		if n != m and abs(n - m) <= 1:
			c += 1
			if c == 2:
				d = True
				o = 'YES'
				break
	if d:
		break
print(o)


i = int(input())
n = list(map(int, input().split()))
n = sorted(list(set(n)))
result = 'NO'
for x in range(len(n) - 2):
	if n[x + 2] - n[x + 1] >= n[x + 1] - n[x] > 0 and n[x + 2] - n[x + 1] <= n[x + 1] - n[x] < 2:
		result = 'YES'
print(result)


input()
t = sorted(set((int(x) for x in input().split())))
for (a, b, c) in zip(t, t[1:], t[2:]):
	if b - a == c - b == 1:
		print('YES')
		break
else:
	print('NO')


n = int(input())
s = sorted(set(map(int, input().split())))
for i in s:
	if i - 1 in s and i + 1 in s:
		print('YES')
		exit(0)
print('NO')


t = int(input())
l1 = [int(x) for x in input().split()]
l1 = list(set(l1))
l1.sort()
i = 0
done = 0
while i < len(l1) - 2:
	if l1[i + 2] - l1[i] <= 2:
		print('YES')
		done = 1
		break
	i += 1
if not done:
	print('NO')


def balls(lst):
	for i in range(len(lst)):
		for j in range(i + 1, len(lst)):
			for k in range(j + 1, len(lst)):
				if lst[i] == lst[j] or lst[i] == lst[k] or lst[j] == lst[k]:
					continue
				if lst[k] - lst[j] <= 2 and lst[k] - lst[i] <= 2 and (lst[j] - lst[i] <= 2):
					return 'YES'
	return 'NO'
n = int(input())
a = [int(x) for x in input().split()]
print(balls(sorted(a)))


n = int(input())
li = sorted(set(map(int, input().split())))
for i in range(2, len(li)):
	if li[i] - li[i - 2] == 2:
		print('YES')
		exit()
print('NO')


def ball():
	n = int(input())
	a = list(map(int, input().split()))
	temp = [0] * (max(a) + 1)
	for i in range(n):
		temp[a[i]] += 1
	for i in range(max(a) - 1):
		if temp[i] > 0 and temp[i + 1] > 0 and (temp[i + 2] > 0):
			return 'YES'
	return 'NO'
print(ball())


n = int(input())
s = list(map(int, input().split()))
l = []
a = 'NO'
for i in s:
	if i not in l:
		l += [i]
l = sorted(l)
if len(l) >= 3:
	for i in range(len(l) - 2):
		if l[i] + 2 == l[i + 1] + 1 == l[i + 2]:
			a = 'YES'
print(a)


def limakfriends(L):
	for i in range(0, len(L) - 2):
		if L[i] + 2 == L[i + 1] + 1 == L[i + 2]:
			return 'YES'
	return 'NO'
n = int(input())
L = list(map(int, input().split()))
L.sort()
M = []
for i in range(0, len(L)):
	if L[i] not in M:
		M.append(L[i])
print(limakfriends(M))


a = sorted({*map(int, [*open(0)][1].split())})
print('NYOE S'[any((x + 1 == y == z - 1 for (x, y, z) in zip(a, a[1:], a[2:])))::2])


input()
X = sorted(set(map(int, input().split())))
if len(X) >= 3:
	for i in range(len(X) - 2):
		if X[i + 2] - X[i] == 2:
			print('YES')
			exit()
print('NO')


def main():
	n = int(input())
	l = list(map(int, input().split()))
	s = sorted(list(set(l)))
	if len(s) < 3:
		return 'NO'
	count = 1
	flag = 0
	for i in range(len(s)):
		for j in range(i + 1, len(s)):
			if abs(s[i] - s[j]) <= 2 and i != j:
				count += 1
				if count >= 3:
					return 'YES'
		if count == 1:
			count += 1
		count -= 1
	return 'NO'
print(main())


x = int(input())
y = input()
z = y.split()
w = [int(d) for d in z]
w.sort()
m = []
flag = False
i = 0
for num in w:
	if w.count(num + 1) != 0 and w.count(num + 2) != 0:
		flag = True
	else:
		continue
if flag == True:
	print('YES')
else:
	print('NO')


n = int(input())
balls = set([int(x) for x in input().split()])
for x in balls:
	if x + 1 in balls and x + 2 in balls:
		print('YES')
		break
else:
	print('NO')


i = int(input())
l = sorted(list(set(list(map(int, input().split())))))
for x in range(0, len(l) - 2):
	if l[x] + 1 == l[x + 1]:
		if l[x] + 2 == l[x + 2]:
			print('YES')
			exit()
print('NO')


def main():
	n = int(input())
	L = [int(x) for x in input().split()]
	print(solver(L))

def solver(L):
	S = set(L)
	L = list(S)
	L.sort()
	for i in range(len(L) - 2):
		if L[i + 1] == L[i] + 1 and L[i + 2] == L[i + 1] + 1:
			return 'YES'
	return 'NO'
main()


def optimal_size(t):
	if len(t) <= 2:
		return 'NO'
	for x in range(len(t) - 2):
		if abs(t[x + 1] - t[x]) <= 2 and abs(t[x + 2] - t[x]) <= 2 and (abs(t[x + 2] - t[x + 1]) <= 2):
			return 'YES'
	return 'NO'
n = int(input())
t = list(map(int, input().split()))
t = list(set(t))
t = sorted(t)
print(optimal_size(t))


n = int(input(''))
nums = input('')
nums = nums.split()
for i in range(n):
	nums[i] = int(nums[i])
nums = list(set(nums))
nums.sort()
yes = False
for i in range(len(nums) - 2):
	if nums[i + 1] == nums[i] + 1 and nums[i + 2] == nums[i] + 2:
		yes = True
		break
if yes:
	print('YES')
else:
	print('NO')


from itertools import combinations
import sys
n = int(input(''))
lst = list(map(int, input().split()))
for item in combinations(lst, 3):
	if item[0] == item[1] or item[0] == item[2] or item[1] == item[2]:
		continue
	if abs(item[0] - item[1]) > 2 or abs(item[0] - item[2]) > 2 or abs(item[2] - item[1]) > 2:
		continue
	print('YES')
	sys.exit()
print('NO')


n = int(input())
l = list(map(int, input().split()))
l = list(set(l))
l.sort()
for i in range(len(l) - 2):
	if l[i] + 1 == l[i + 1] and l[i + 1] + 1 == l[i + 2]:
		print('YES')
		exit()
print('NO')


n = int(input())
l = list(map(int, input().split()))
s = list(set(l))
if len(s) < 3:
	print('NO')
else:
	s.sort()
	for i in range(len(s) - 2):
		if s[i + 2] - s[i + 1] == 1 and s[i + 1] - s[i] == 1:
			print('YES')
			break
	else:
		print('NO')


(f, n, l) = (0, int(input()), sorted(list(set(map(int, input().split())))))
for x in range(1, len(l) - 1):
	if l[x] - l[x - 1] == 1 and l[x + 1] - l[x] == 1:
		f = 1
		break
print(['NO', 'YES'][f == 1])


N = int(input())
S = list(set(list(map(int, input().split()))))
N = len(S)
f = False
S.sort()
for i in range(N - 2):
	if S[i] == S[i + 1] - 1 and S[i] == S[i + 2] - 2:
		f = True
		break
if f:
	print('YES')
else:
	print('NO')


3

def good_pair(a, b):
	return 0 < max(a, b) - min(a, b) <= 2
n = int(input())
balls = sorted(list(map(int, input().split())))
ans = 'NO'
for i in range(n):
	a = balls[i]
	for j in range(i + 1, n):
		b = balls[j]
		for k in range(j + 1, n):
			c = balls[k]
			if good_pair(a, b) and good_pair(b, c) and good_pair(a, c):
				ans = 'YES'
				break
print(ans)


n = int(input())
balls = list(map(int, input().split()))
yes = False
for i in range(n):
	for j in range(n):
		if balls[i] != balls[j] and abs(balls[i] - balls[j]) <= 2:
			for k in range(n):
				if balls[k] != balls[i] and balls[k] != balls[j] and (abs(balls[i] - balls[k]) < 2) and (abs(balls[j] - balls[k]) < 2):
					yes = True
					break
print('YES' if yes else 'NO')


def __starting_point():
	n = int(input())
	b = sorted(set(map(int, input().split(' '))))
	for i in range(len(b) - 2):
		if len(set(b[i:i + 3])) == 3:
			if b[i + 2] - b[i] <= 2 and b[i + 2] - b[i + 1] <= 1:
				print('YES')
				break
	else:
		print('NO')
__starting_point()


def solution():
	n = int(input())
	mas = [int(x) for x in input().split()]
	for i in mas:
		if i + 1 in mas and i + 2 in mas:
			return 'YES'
	return 'NO'
print(solution(), end='')


def bear_friends():
	total = int(input())
	balls = list(map(int, input().split()))
	dic = {}
	for i in range(len(balls)):
		dic[balls[i]] = 1
		if balls[i] + 1 in dic and balls[i] + 2 in dic:
			return 'YES'
		elif balls[i] + 1 in dic and balls[i] - 1 in dic:
			return 'YES'
		elif balls[i] - 1 in dic and balls[i] - 2 in dic:
			return 'YES'
	return 'NO'
A = bear_friends()
print(A)


n = int(input())
L = list(map(int, input().split()))
R = []
for i in range(n):
	if L[i] in R:
		lol = 1
	else:
		R = R + [L[i]]
R.sort()
i = 2
while i < len(R) and R[i] - R[i - 2] > 2:
	i += 1
if i == len(R) or len(R) < 3:
	print('NO')
else:
	print('YES')


(n, s) = (input(), list(map(int, input().split())))
print(['NO', 'YES'][any((i in s and i + 1 in s and (i + 2 in s) for i in s))])


n = int(input())
solve = []
a = list(map(int, input().split()))
for i in a:
	if i in solve:
		flag = 1
	else:
		solve.append(i)
solve.sort()
for i in range(len(solve) - 2):
	if solve[i + 2] - solve[i + 1] == 1 and solve[i + 1] - solve[i] == 1:
		print('YES')
		exit()
print('NO')


3
n = int(input())
a = list(map(int, input().split()))
a = list(set(a))
a.sort()
for i in range(len(a) - 2):
	if a[i + 1] == a[i] + 1 and a[i + 2] == a[i] + 2:
		print('YES')
		return
print('NO')


n = int(input())
a = [int(x) for x in input().split()]
for i in range(n):
	for j in range(n):
		for k in range(n):
			if a[i] + 1 == a[j] and a[j] + 1 == a[k]:
				print('YES')
				exit()
print('NO')


input()
T = sorted(set(map(int, input().split())))
print('YES' if any((T[i] + 2 == T[i + 1] + 1 == T[i + 2] for i in range(len(T) - 2))) else 'NO')


n = int(input())
a = [int(i) for i in input().split()]
for i in a:
	for j in a:
		for k in a:
			if i != j and j != k and (k != i) and (abs(i - k) <= 2) and (abs(i - j) <= 2) and (abs(k - j) <= 2):
				print('YES')
				exit()
print('NO')


import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def sumc(t):
	s = 0
	while t > 0:
		s += t % 10
		t //= 10
	return s
n = ii()
a = li()
seta = sorted(set(a))
lsa = len(seta)
if lsa < 3:
	print('NO')
else:
	for i in range(lsa - 2):
		if seta[i + 2] - 2 == seta[i]:
			print('YES')
			exit()
	print('NO')


_ = input()
balls = sorted(list(set(map(lambda x: int(x), input().split()))))
for i in range(len(balls) - 2):
	a = balls[i]
	b = balls[i + 2]
	if b - a <= 2:
		print('YES')
		break
else:
	print('NO')


def main():
	n = int(input())
	l = list(map(int, input().split()))
	s = sorted(list(set(l)))
	if len(s) < 3:
		return 'NO'
	for i in range(len(s)):
		for j in range(len(s)):
			for k in range(len(s)):
				if max(s[i], s[j], s[k]) - s[i] + max(s[i], s[j], s[k]) - s[j] + max(s[i], s[j], s[k]) - s[k] == 3 and i != j and (i != k) and (j != k):
					return 'YES'
	return 'NO'
print(main())


n = int(input())
mass = list(map(int, input().split()))
mass.sort()
tmp_mass = []
flag = False
for i in range(n):
	if mass[i] in tmp_mass:
		continue
	else:
		tmp_mass.append(mass[i])
for i in range(len(tmp_mass) - 2):
	if tmp_mass[i + 1] - tmp_mass[i] <= 2:
		if tmp_mass[i + 2] - tmp_mass[i] <= 2:
			flag = True
			break
if flag:
	print('YES')
else:
	print('NO')


import math
import os
import random
import re
import sys
import functools
from operator import itemgetter, attrgetter
n = int(input())
s = sorted(set(map(int, input().strip().split())))
r = 0
for i in range(1, len(s)):
	if r == 2:
		break
	if s[i] - s[i - 1] == 1:
		r += 1
	else:
		r = 0
print('YES' if r == 2 else 'NO')


n = int(input())
t = list(map(int, input().split()))
t.sort()
for i in range(n):
	for j in range(i + 1, n):
		if t[i] == t[j] or abs(t[i] - t[j]) > 2:
			continue
		for k in range(j + 1, n):
			if t[i] == t[k] or t[j] == t[k] or abs(t[i] - t[k]) > 2 or (abs(t[j] - t[k]) > 2):
				continue
			print('YES')
			exit(0)
print('NO')


c = 1
input()
l = sorted(set(map(int, input().split())))
for i in range(len(l) - 1):
	if l[i + 1] - l[i] == 1:
		c += 1
	else:
		c = 1
	if c == 3:
		break
print(['NO', 'YES'][c == 3])


n = int(input())
a = list(map(int, input().split()))
b = set(a)
c = sorted(b)
for i in range(len(c) - 2):
	if c[i] - c[i + 2] >= -2:
		print('YES')
		break
else:
	print('NO')


def main():
	_ = input()
	nums = list(map(int, input().split()))
	nums = sorted(set(nums))
	has_consecutive = False
	for (num, last_num) in zip(nums[1:], nums):
		if num - last_num == 1:
			if has_consecutive:
				print('YES')
				return
			has_consecutive = True
		else:
			has_consecutive = False
	print('NO')
main()


n = int(input())
t = set(map(int, input().split()))
x = list(t)
x.sort()
a = 0
for i in x:
	if i + 1 in x and i + 2 in x:
		a = 1
		break
if a == 1:
	print('YES')
else:
	print('NO')


import sys
n = int(input())
m = sorted(list(set(map(int, input().split()))))
f = False
for i in range(len(m) - 2):
	if m[i + 1] - m[i] <= 2 and m[i + 2] - m[i + 1] <= 2 and (m[i + 2] - m[i] <= 2):
		print('YES')
		f = True
		break
if not f:
	print('NO')


import sys
len_input = input()
seq_input = input().split()
seq = sorted([int(x) for x in seq_input])
seq_red = sorted([int(x) for x in list(set(seq))])
if len(seq_red) < 3:
	print('NO')
	sys.exit()
seq_sub = [seq_red[i] - seq_red[i + 2] for i in range(len(seq_red) - 2)]
seq_truth = [1 if abs(x) < 3 else 0 for x in seq_sub]
seq_sum = sum(seq_truth)
if seq_sum == 0:
	print('NO')
elif seq_sum > 0:
	print('YES')


n = int(input())
l = sorted(set(map(int, input().split())))
for i in range(1, len(l) - 1):
	if (l[i + 1], l[i]) == (l[i] + 1, l[i - 1] + 1):
		print('YES')
		exit(0)
print('NO')


n = int(input())
m = sorted(map(int, input().split()))
for i in range(n - 2):
	a = m[i]
	if a + 1 in m and a + 2 in m:
		print('YES')
		exit()
print('NO')


n = int(input())
t = sorted(list(map(int, input().split())))
for i in range(n - 2):
	if t[i] + 1 in t and t[i] + 2 in t:
		print('YES')
		break
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
k = list(set(l))
k.sort()
if len(k) < 3:
	print('NO')
	exit()

def check(a, b):
	if abs(a - b) <= 2 and a != b:
		return True
	else:
		return False
for i in range(len(k) - 2):
	if check(k[i], k[i + 1]) and check(k[i + 1], k[i + 2]) and check(k[i], k[i + 2]):
		print('YES')
		exit()
print('NO')


(n, s) = (input(), sorted(set(map(int, input().split()))))
for _ in s:
	if _ + 1 in s and _ + 2 in s:
		print('YES')
		break
else:
	print('NO')


n = int(input())
t = list(map(int, input().split()))
t = list(set(t))
t.sort(reverse=True)
for i in range(len(t)):
	if len(t) > i + 2:
		if t[i] - t[i + 1] <= 1:
			if t[i + 1] - t[i + 2] <= 1:
				print('YES')
				break
	else:
		print('NO')
		break


n = int(input())
l = list(map(int, input().split()))
l.sort()
for i in range(len(l)):
	for j in range(i, len(l)):
		if l[j] - l[i] == 1:
			for k in range(j, len(l)):
				if l[k] - l[j] == 1:
					print('YES')
					exit(0)
print('NO')


n = int(input())
l = sorted(map(int, input().split()))
for i in l:
	m = l[:]
	for j in range(n):
		m[j] -= i
	if {0, 1, 2} <= set(m):
		print('YES')
		break
else:
	print('NO')


(n, t) = (int(input()), sorted(set(map(int, input().split()))))
print('YES' if any((t[i + 2] - t[i] == 2 for i in range(len(t) - 2))) else 'NO')


input()
s = set(map(int, input().split()))
print(['NO', 'YES'][any((i in s and i + 1 in s and (i + 2 in s) for i in range(1000)))])


n = input()
ans = 0
a = [int(x) for x in input().split()]
for i in a:
	for j in a:
		for k in a:
			if i != j and j != k and (i != k) and (abs(i - k) <= 2) and (abs(j - k) <= 2) and (abs(i - j) <= 2):
				ans = 1
if ans == 1:
	print('YES')
else:
	print('NO')


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
input()
lst = sorted(set(get_int_list()))
n = len(lst)
flag = False
for i in range(n - 2):
	if lst[i] + 2 == lst[i + 1] + 1 == lst[i + 2]:
		flag = True
		break
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
balls = sorted([int(i) for i in input().split(' ')])

def main():
	min_ball = balls[0]
	prev_ball = balls[0]
	gifts = 1
	for i in range(1, len(balls)):
		if prev_ball == balls[i]:
			continue
		elif balls[i] > min_ball + 2:
			prev_ball = min_ball = balls[i]
			gifts = 1
			continue
		if gifts == 2:
			return 'YES'
		gifts += 1
		prev_ball = balls[i]
	return 'NO'
print(main())


a = int(input())
l = sorted(set(map(int, input().split())))
for i in range(len(l) - 2):
	if l[i] + 2 == l[i + 2]:
		print('YES')
		break
else:
	print('NO')


class Stack(object):

	def __init__(self):
		self.items = []

	def push(self, new):
		self.items.append(new)

	def pop(self):
		return self.items.pop()

	def peek(self):
		return self.items[-1]

	def empty(self):
		return self.items == []

	def size(self):
		return len(self.items)

	def popall(self):
		while not self.empty():
			self.items.pop()
n = int(input())
T = [int(i) for i in input().split()]
T.sort()
S = Stack()
S.push(T[0])
i = 1
bool = False
while i <= n - 1 and (not bool):
	if T[i] == S.peek() + 1:
		if S.size() == 2:
			S.push(T[i])
			bool = True
		else:
			S.push(T[i])
	elif T[i] >= S.peek() + 2:
		S.popall()
		S.push(T[i])
	i += 1
if bool:
	print('YES')
else:
	print('NO')


t = int(input())
l = list(map(int, input().split()))
s = set(l)
if len(s) < 3:
	print('NO')
	exit()
else:
	l = list(s)
	l.sort()
	h = 0
	for i in range(1, len(l)):
		if l[i] - l[i - 1] <= 1:
			h += 1
		else:
			h = 0
		if h == 2:
			print('YES')
			exit()
	print('NO')


import sys
n = sys.stdin.readline()
m = []

def cont(i: int, li: list) -> bool:
	return i in li and i - 1 in li and (i + 1 in li)
for l in sys.stdin:
	m = sorted([int(x) for x in l.split()])
if any((cont(i, m) for i in m)):
	print('YES')
else:
	print('NO')


n = int(input())
ch = input()
d1 = ch.split()
d2 = []
d = []
for i in d1:
	d2.append(int(i))
j = 0
d2.sort()
for i in d2:
	if i not in d:
		d.append(i)
B = False
while j < len(d) - 2 and B == False:
	if d[j + 2] - d[j] == 2 and d[j + 1] - d[j] == 1 and (d[j + 2] - d[j + 1] == 1):
		B = True
	j += 1
if B:
	print('YES')
else:
	print('NO')


def p1():
	(n, m) = [int(i) for i in input().split()]
	l = [int(i) for i in input().split()]
	k = []
	i = 1
	f = 1
	while f:
		while i in l and i <= m:
			i = i + 1
		if i <= m:
			k.append(i)
			m = m - i
		else:
			f = 0
		i = i + 1
	print(len(k))
	for i in k:
		print(i, end=' ')

def p2():
	n = int(input())
	l = list(set([int(i) for i in input().split()]))
	l.sort()
	ans = 'NO'
	for i in range(len(l) - 3 + 1):
		if l[i] == l[i + 1] - 1 and l[i + 1] == l[i + 2] - 1:
			ans = 'YES'
			break
	print(ans)
p2()


n = int(input())
a = list(map(int, input().split()))
a = sorted(list(set(a)))
for i in range(len(a) - 2):
	if a[i] != a[i + 1] and abs(a[i] - a[i + 1]) <= 2 and (a[i] != a[i + 2]) and (abs(a[i] - a[i + 2]) <= 2) and (a[i + 1] != a[i + 2]) and (abs(a[i + 1] - a[i + 2]) <= 2):
		print('YES')
		exit()
print('NO')


def judge(balls):
	if len(balls) < 3:
		return False
	candidates = set()
	counter = 1
	sorted_balls = sorted(balls)
	prev_ball = sorted_balls.pop(0)
	for ball in sorted_balls:
		if prev_ball + 1 == ball:
			counter += 1
		else:
			candidates.add(counter)
			counter = 1
		prev_ball = ball
	candidates.add(counter)
	return max(candidates) >= 3

def main():
	_ = input()
	balls = set(map(int, input().split()))
	if judge(balls):
		print('YES')
	else:
		print('NO')
main()


input()
a = list(sorted(set(map(int, input().split()))))
for i in range(len(a) - 2):
	if a[i + 2] - a[i] == 2:
		print('YES')
		exit()
print('NO')


import time
n = int(input())
a = [int(i) for i in input().split()]
start = time.time()
a = sorted(list(set(a)))
ans = 'NO'
for i in range(len(a) - 2):
	if a[i + 2] - a[i] <= 2:
		ans = 'YES'
		break
print(ans)
finish = time.time()


n = int(input())
m = list(map(int, input().split()))
ans = False
for i in m:
	for j in m:
		for k in m:
			s = set()
			h = []
			s.add(i)
			s.add(j)
			s.add(k)
			h.append(i)
			h.append(j)
			h.append(k)
			h.sort()
			ans = ans or (abs(h[0] - h[2]) <= 2 and len(s) == 3)
if ans:
	print('YES')
else:
	print('NO')


def get_input():
	num = input()
	line = input()
	test_cases = line.split()
	result = []
	for i in test_cases:
		result.append(int(i))
	return result

def send_balls(n, l):
	l = sorted(l)
	l2 = l.copy()
	for x in range(0, n - 2):
		if l[x] == l[x + 1]:
			l2.remove(l[x + 1])
	else:
		for i in range(0, len(l2) - 2):
			if l2[i + 1] - l2[i] < 2 and l2[i + 2] - l2[i + 1] < 2 and (l2[i + 1] != l2[i]) and (l2[i + 2] != l2[i + 1]):
				return 'YES'
	return 'NO'
test_cases = get_input()
print(send_balls(len(test_cases), test_cases))


n = int(input())
li = sorted(map(int, input().split()))
s = ''
for i in range(1, n):
	if li[i] - li[i - 1] != 1:
		if li[i] - li[i - 1] != 0:
			s += '*'
	else:
		s += str(li[i] - li[i - 1])
print('YES' if '11' in s else 'NO')


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
cek = 1
temp = -1
for i in range(n):
	if a[i] == temp + 1:
		cek += 1
		temp = a[i]
	elif a[i] == temp:
		pass
	else:
		cek = 1
		temp = a[i]
	if cek >= 3:
		break
if cek >= 3:
	print('YES')
else:
	print('NO')


cnt = lambda s, i: s.count(i)
iip = lambda : int(input())
sip = lambda : input()
f = lambda : map(int, input().split())
lf = lambda : list(map(int, input().split()))
n = iip()
l = sorted(list(set(lf())))
for i in range(1, len(l) - 1):
	if l[i] - l[i - 1] == 1 and l[i + 1] - l[i] == 1:
		exit(print('YES'))
print('NO')


def read():
	return [int(x) for x in input().split()]

def main():
	(n,) = read()
	t = sorted(set(read()))
	res = False
	for i in range(0, len(t) - 2):
		if t[i + 2] - t[i] <= 2:
			res = True
			break
	print(res and 'YES' or 'NO')
main()


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
ara = inara()
ara.sort()
for i in range(n):
	for j in range(i + 1, n):
		for k in range(j + 1, n):
			if ara[i] < ara[j] and ara[j] < ara[k] and (ara[k] <= ara[i] + 2):
				print('YES')
				exit(0)
print('NO')


n = int(input())
a = [int(s) for s in input().split()]
a.sort()
i = 1
while i < len(a):
	if a[i] == a[i - 1]:
		del a[i]
	else:
		i += 1
key = 0
for i in range(len(a) - 2):
	if a[i + 1] == a[i] + 1 and a[i + 2] == a[i + 1] + 1:
		print('YES')
		key = 1
		break
	elif a[i + 2] > a[i + 1] + 1:
		i += 1
if key == 0:
	print('NO')


n = int(input())
s = input().split()
s = list(map(int, s))
s = list(dict.fromkeys(s))
s.sort()
count = 0
for i in range(len(s) - 2):
	if s[i + 2] - s[i + 1] == 1 and s[i + 1] - s[i] == 1:
		print('YES')
		count += 1
		break
if count == 0:
	print('NO')


x = int(input())
s = [int(n) for n in input().split()]
s.sort()
l = 0
for n in range(x - 2):
	if s[n] + 1 in s and s[n] + 2 in s:
		print('YES')
		l = 1
		break
	else:
		l = 0
if l == 0:
	print('NO')


def func(arr, cnt):
	if cnt < 3:
		return False
	for i in range(cnt - 2):
		if arr[i + 1] - arr[i] == arr[i + 2] - arr[i + 1] == 1:
			return True
	return False
n = int(input())
lst = [int(x) for x in input().split()]
lst.sort()
arr = [-2]
cnt = 0
for i in lst:
	if i != arr[-1]:
		arr.append(i)
		cnt += 1
del arr[0]
if func(arr, cnt):
	print('YES')
else:
	print('NO')


n = int(input())
daf = set(map(int, input().split()))
daf = sorted(daf)
for i in range(len(daf) - 2):
	if daf[i + 2] - daf[i] == 2:
		print('YES')
		break
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a.sort()
i = 1
b = []
while i < len(a):
	while i < len(a) and a[i - 1] == a[i]:
		i += 1
	b.append(a[i - 1])
	i += 1
if a[n - 1] != a[n - 2]:
	b.append(a[n - 1])
a = b
flag = False
for i in range(2, len(a)):
	if a[i] != a[i - 1] and a[i - 1] != a[i - 2] and (a[i] - a[i - 1] == 1) and (a[i - 1] - a[i - 2] == 1):
		flag = True
		break
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
l = sorted(set(map(int, input().split())))
for i in range(1, len(l) - 1):
	if l[i] - l[i - 1] == 1 and l[i + 1] - l[i] == 1:
		print('YES')
		break
else:
	print('NO')


def main():
	n = int(input())
	t = sorted([int(i) for i in input().split()])
	l = 0
	p = None
	for ti in t:
		if ti == p:
			continue
		if p is None or ti == p + 1:
			p = ti
			l += 1
		else:
			p = ti
			l = 1
		if l == 3:
			print('YES')
			return
	print('NO')
main()


n = int(input())
balls = list(map(int, input().split()))
balls = set(balls)
balls = sorted(balls)
res = 'NO'
for i in range(1, len(balls) - 1):
	if balls[i] - balls[i - 1] <= 2 and balls[i + 1] - balls[i] <= 2 and (balls[i + 1] - balls[i - 1] <= 2):
		res = 'YES'
print(res)


cnt = int(input())
num_list = sorted(set(map(int, input().split())))
idx = 0
while idx < len(num_list) - 2:
	z = num_list[idx:idx + 3]
	x = min(z)
	y = max(z)
	if y - x <= 2:
		if len(set(z)) == 3:
			print('YES')
			break
	idx += 1
else:
	print('NO')


ans = 'NO'
x = int(input())
num = list(map(int, input().split()))
for i in num:
	if i + 1 in num and i + 2 in num:
		ans = 'YES'
		break
print(ans)


n = int(input())
l = list(set(map(int, input().split())))
l.sort()
n = len(l)
cnt = 0
check = 0
for i in range(1, n):
	if l[i] == l[i - 1] + 1:
		cnt -= -1
	else:
		cnt = 0
	if cnt == 2:
		check = 1
		break
if check:
	print('YES')
else:
	print('NO')


n = int(input())
aList = [int(x) for x in input().split()]
found = False
foundBottom = False
foundItself = False
foundTop = False
count = 0
for i in aList:
	if found:
		break
	if i in aList and (not foundItself):
		count += 1
		foundItself = True
	if i + 1 in aList and (not foundTop):
		count += 1
		foundTop = True
	if i - 1 in aList and (not foundBottom):
		count += 1
		foundBottom = True
	if count >= 3 and (not found):
		print('YES')
		found = True
	count = 0
	foundBottom = False
	foundItself = False
	foundTop = False
if not found:
	print('NO')


n = int(input())
a = list(sorted(set(map(int, input().split()))))
n = len(a)
ret = False
for i in range(2, n):
	if a[i - 2] + 1 == a[i - 1] and a[i - 1] + 1 == a[i]:
		ret = True
if ret:
	print('YES')
else:
	print('NO')


n = int(input())
a = sorted(set(map(int, input().split())))
ok = False
for i in range(len(a) - 2):
	x = a[i]
	if a[i] == x and a[i + 1] == x + 1 and (a[i + 2] == x + 2):
		ok = True
		break
print('YES' if ok else 'NO')


n = int(input())
t2 = list(map(int, input().split()))
t = []
for item in t2:
	if item not in t:
		t.append(item)
t.sort()
flag = 0
n = len(t)
for i in range(n - 2):
	if abs(t[i] - t[i + 1]) <= 2 and abs(t[i + 1] - t[i + 2]) <= 2 and (abs(t[i] - t[i + 2]) <= 2):
		if t[i] == t[i + 1] or t[i + 1] == t[i + 2] or t[i] == t[i + 2]:
			pass
		else:
			flag = 1
			print('YES')
			exit(0)
print('NO')


n = input()
n = list(set([int(x) for x in input().split(' ')]))
n.sort()
for i in range(2, len(n)):
	if n[i] - n[i - 2] <= 2:
		print('YES')
		exit()
print('NO')


n = int(input())
arr = list(map(int, input().split()))
arr = set(arr)
arr = sorted(arr)
for i in range(len(arr) - 2):
	if arr[i + 2] - arr[i + 1] == 1 and arr[i + 1] - arr[i] == 1:
		print('YES')
		break
else:
	print('NO')


n = int(input())
t = [int(x) for x in input().split()]
isPossible = False
while len(t) > 2:
	current = t[0]
	plusOne = current + 1
	plusTwo = current + 2
	minusOne = current - 1
	minusTwo = current - 2
	if plusOne in t and plusTwo in t:
		isPossible = True
		break
	elif plusOne in t and minusOne in t:
		isPossible = True
		break
	elif minusOne in t and minusTwo in t:
		isPossible = True
		break
	else:
		t.remove(current)
if isPossible:
	print('YES')
else:
	print('NO')


n = int(input())
inp = list(map(int, input().split()))
from collections import Counter
c = Counter(inp)
inp = list(c.keys())
inp.sort()
if len(inp) > 3:
	flag = 0
	for i in range(len(inp) - 3 + 1):
		if inp[i + 1] - inp[i] == 1 and inp[i + 2] - inp[i + 1] == 1:
			flag = 1
			print('YES')
			break
	if flag == 0:
		print('NO')
elif len(inp) == 3:
	if inp[1] - inp[0] == 1 and inp[2] - inp[1] == 1:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


import sys
n = int(input())
l = list(map(int, input().split()))
l.sort()
p = list(set(l))
p.sort()
flag = False
for i in range(0, len(p) - 2):
	if p[i + 2] - p[i] == 2:
		flag = True
if flag:
	print('YES')
else:
	print('NO')


n = int(input())
for i in range(1):
	t = [int(x) for x in input().split()]

def checkyesno():
	s = list(set(t))
	u = sorted(s)
	v = len(s)
	y = 0
	z = 0
	c = 0
	for a in range(0, v - 2):
		if (u[a] + u[a + 1] + u[a + 2]) / 3 == u[a + 1]:
			z += 1
		if u[a + 2] - u[a + 1] == u[a + 1] - u[a] == 1:
			c += 1
	if z > 0 and c > 0:
		for i in range(0, v - 1):
			if u[i] - u[i + 1] == -1:
				y += 1
	if y >= 2:
		result = 'YES'
		print(result)
	else:
		result = 'NO'
		print(result)
if len(t) < 3:
	result = 'NO'
	print(result)
elif len(list(set(t))) < 3:
	result = 'NO'
	print(result)
else:
	checkyesno()


n = int(input())
a = input().split()
for i in range(n):
	a[i] = int(a[i])
a = set(a)
a = list(a)
a.sort()
n = len(a)
if n < 3:
	print('NO')
	exit(0)
for i in range(n - 2):
	if a[i] + 1 == a[i + 1] and a[i + 1] + 1 == a[i + 2]:
		print('YES')
		exit(0)
print('NO')


def main():
	input()
	(a, b) = (0, -1)
	for c in sorted(set(map(int, input().split()))):
		if a < b < c < a + 3:
			print('YES')
			return
		(a, b) = (b, c)
	print('NO')
main()


count = int(input())
temp = input().split(' ')
sizes = [int(x) for x in temp]
sizes.sort()
buff1 = None
buff2 = None
valid = False
for x in sizes:
	if x == buff2:
		continue
	if buff2 is not None and buff1 is not None and (x - buff2 == 1) and (buff2 - buff1 == 1):
		valid = True
		break
	buff1 = buff2
	buff2 = x
if valid:
	print('YES')
else:
	print('NO')


import sys
n = int(input())
a = map(int, input().split())
a = list(set(a))
a.sort()
i = 2
while i < len(a):
	if int(a[i - 2]) == int(a[i]) - 2:
		print('YES\n')
		sys.exit()
	i += 1
print('NO\n')


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
nb_balls = int(input())
sizes = sorted(set(read_ints()))
ans = 'NO'
if len(sizes) >= 3:
	for i in range(len(sizes) - 2):
		if sizes[i + 2] == sizes[i + 1] + 1 == sizes[i] + 2:
			ans = 'YES'
			break
print(ans)


import random
import sys
import os
n = int(input())
s = set(map(int, input().split()))
s = sorted(s)
for i in range(0, len(s) - 2):
	if s[i + 2] - s[i] == 2:
		print('YES')
		exit()
print('NO')


n = int(input())
arr = [int(x) for x in input().split()]
s = list(set(arr))
s = sorted(s)
ans = 0
for i in range(len(s) - 1):
	if ans == 2:
		break
	if s[i] - s[i + 1] == -1:
		ans += 1
	else:
		ans = 0
print('YES' if ans >= 2 else 'NO')


'__author__' == 'deepak Singh Mehta(learning to code)) '

def __starting_point():
	n = int(input())
	arr = list(map(int, input().split()))
	flag = False
	for i in range(len(arr)):
		if arr[i] + 1 in arr and arr[i] + 2 in arr:
			flag = True
			break
	if flag:
		print('YES')
	else:
		print('NO')
__starting_point()


input()
_ = list(sorted(set(list(map(int, input().split())))))
__ = 0
___ = 0
for i in range(len(_) - 1):
	if _[__ + 1] - _[__] in range(1, 3):
		___ += 1
	else:
		___ = 0
	if ___ == 2:
		if _[__ + 1] - _[__ - 1] in range(1, 3):
			print('YES')
			exit()
		else:
			___ = 0
	__ += 1
print('NO')


n = int(input())
a = list(set(map(int, input().split())))
a.sort()
works = False
for i in range(1, len(a) - 1):
	if a[i - 1] + 1 == a[i] and a[i] + 1 == a[i + 1]:
		works = True
		break
print('YES' if works else 'NO')


z = int(input())
n = input().split()
for i in range(z):
	n[i] = int(n[i])
n = list(set(n))
n.sort()
l = len(n)
for i in range(l):
	if i + 3 > l:
		print('NO')
		break
	if n[i] + 1 == n[i + 1]:
		if n[i + 1] + 1 == n[i + 2]:
			print('YES')
			break
else:
	print('NO')


def mai():
	a = int(input())
	b = sorted(list(set([int(i) for i in input().split()])))
	for i in range(len(b) - 2):
		if b[i + 1] - b[i] == 1 and b[i + 2] - b[i + 1] == 1:
			print('YES\n')
			return
	print('NO\n')
	return
mai()


n = int(input())
string = input()
sizes = sorted(map(int, string.split()))
condition = False
for x in range(n - 2):
	for y in range(x + 1, n - 1):
		for z in range(y + 1, n):
			(a, b, c) = (sizes[x], sizes[y], sizes[z])
			if a != b and b != c and (c - a <= 2):
				print('YES')
				condition = True
				break
		if condition:
			break
	if condition:
		break
else:
	print('NO')


(n, arr) = (int(input()), list(map(int, input().split())))
buck = [0] * 3000
i = 0
for i in range(n):
	buck[arr[i]] += 1
	i += 1
i = 0
result = 'NO'
for i in range(2000):
	if buck[i] > 0 and buck[i + 1] > 0 and (buck[i + 2] > 0):
		result = 'YES'
	i += 1
print(result)


import collections, itertools, functools, math

def solve():
	n = int(input())
	t = list(sorted(set(map(int, input().split()))))
	n = len(t)
	for i in range(n):
		a = t[i]
		for j in range(i + 1, n):
			b = t[j]
			for k in range(j + 1, n):
				c = t[k]
				if c - a <= 2:
					return 'YES'
	return 'NO'
print(solve())


a = int(input())
l = list(map(int, input().strip().split(' ')))
for c in l:
	if c + 1 in l and c + 2 in l or (c - 1 in l and c - 2 in l):
		print('YES')
		exit()
print('NO')


n = int(input())
t = list(set(map(int, input().split())))
t.sort()
l = len(t)
if l < 3:
	print('NO')
	exit()
f = t[0]
s = t[1]
tr = False
for i in range(2, len(t)):
	if t[i] - f <= 2:
		tr = True
		break
	else:
		f = s
		s = t[i]
if tr:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
a = list(set(a))
a.sort()
f = -1
for i in range(len(a) - 2):
	if a[i + 2] - a[i + 1] == 1 and a[i + 1] - a[i] == 1:
		f = 1
		break
if f == 1:
	print('YES')
else:
	print('NO')


n = int(input())
b = list(map(int, input().split()))
b = sorted(list(set(b)))
l = len(b)
g = []
for i in range(l):
	if i == l - 1:
		if b[i] - 2 in g:
			g.append(b[i])
		elif b[i] - 1 in g:
			g.pop()
	elif b[i] + 1 in b:
		g.append(b[i])
	elif b[i] - 1 in b:
		if b[i] - 2 in b:
			g.append(b[i])
		else:
			g.pop()
if len(g) > 2:
	print('YES')
else:
	print('NO')


n = int(input())
s = list(set(list(map(int, input().strip().split()[:n]))))
s.sort()
for x in range(len(s) - 2):
	if s[x + 1] - s[x] <= 1 and s[x + 2] - s[x + 1] <= 1:
		print('YES')
		break
else:
	print('NO')


def main(n, a):

	def valid(i, j, k):
		if i == j or j == k or i == k:
			return False
		if abs(i - j) > 2 or abs(i - k) > 2 or abs(j - k) > 2:
			return False
		return True
	for i in range(n):
		for j in range(i + 1, n):
			for k in range(j + 1, n):
				if valid(a[i], a[j], a[k]):
					return 'YES'
	return 'NO'
print(main(int(input()), list(map(int, input().split(' ')))))


def isGift2(a, b):
	return a != b and abs(a - b) <= 2

def isGift3(a, b, c):
	return isGift2(a, b) and isGift2(b, c) and isGift2(a, c)

def isGift(lst):
	for i in range(len(lst)):
		for j in range(i + 1, len(lst)):
			for k in range(j + 1, len(lst)):
				if isGift3(lst[i], lst[j], lst[k]):
					return True
	return False

def main():
	n = int(input())
	line = input()
	line = [int(i) for i in line.split()]
	line = line[0:n]
	r = 'YES' if isGift(line) else 'NO'
	print(r)
main()


num = int(input())
arr = set(sorted(map(int, input().split())))
for n in arr:
	if n + 1 in arr and n + 2 in arr:
		print('YES')
		exit()
print('NO')


__author__ = 'suvasish'
import sys
n = int(input())
ins = list(map(int, input().split(' ')))
v = sorted(ins)
for i in range(0, len(v)):
	t = v[i]
	t1 = t + 1
	t2 = t1 + 1
	if t1 in v and t2 in v:
		print('YES')
		sys.exit()
print('NO')


input()
T = set(map(int, input().split()))
print('YES' if any((t - 1 in T and t + 1 in T for t in T)) else 'NO')


n = int(input())
l = list(map(int, input().split()))
l = list(set(l))
n = len(l)

def partition(arr, low, high):
	i = low - 1
	pivot = arr[high]
	for j in range(low, high):
		if arr[j] <= pivot:
			i = i + 1
			(arr[i], arr[j]) = (arr[j], arr[i])
	(arr[i + 1], arr[high]) = (arr[high], arr[i + 1])
	return i + 1

def quickSort(arr, low, high):
	if low < high:
		pi = partition(arr, low, high)
		quickSort(arr, low, pi - 1)
		quickSort(arr, pi + 1, high)
quickSort(l, 0, n - 1)

def func(arr, n):
	for i in range(n - 2):
		if arr[i + 1] - arr[i] == 1 and arr[i + 2] - arr[i + 1] == 1:
			return 'YES'
	return 'NO'
print(func(l, n))


import sys
import math
import bisect
import itertools
import random
import re

def solve(A):
	for B in itertools.combinations(A, 3):
		if len(set(B)) == 3 and max(B) - min(B) <= 2:
			return True
	return False

def main():
	n = int(input())
	A = list(map(int, input().split()))
	if solve(A):
		print('YES')
	else:
		print('NO')
main()


n = int(input())
t = [int(x) for x in input().split()]

def check(t):
	t = sorted(set(t))
	for i in range(len(t) - 2):
		if (t[i + 1], t[i + 2]) == (t[i] + 1, t[i] + 2):
			return True
	return False
print('YES' if check(t) else 'NO')


import sys
n = int(input())
t = sorted(list(set([int(x) for x in input().split()])))
for i in range(0, len(t) - 2):
	if t[i + 1] - t[i] == 1 and t[i + 2] - t[i + 1] == 1:
		print('YES')
		sys.exit(0)
print('NO')


n = int(input().strip())
d = {}
for i in input().strip().split():
	x = int(i)
	if x not in d:
		d[x] = 1
a = list(d.keys())
a.sort()
for i in range(len(a) - 2):
	if a[i + 2] - a[i] <= 2:
		print('YES')
		exit(0)
print('NO')


n = int(input())
per = list(map(int, input().split()))
per2 = False
for i in range(n - 2):
	if per2:
		break
	for j in range(i + 1, n - 1):
		if per2:
			break
		for t in range(j + 1, n):
			if max(per[t], per[j]) - min(per[t], per[j]) in (1, 2) and max(per[t], per[i]) - min(per[t], per[i]) in (1, 2) and (max(per[i], per[j]) - min(per[i], per[j]) in (1, 2)):
				print('YES')
				per2 = True
				break
if not per2:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
set_ = sorted(set(l))
for i in set_:
	if i + 1 in set_ and i + 2 in set_:
		print('YES')
		exit()
print('NO')


def main():
	input()
	ball_sizes = [int(_) for _ in input().split()]
	ball_sizes = list(dict.fromkeys(ball_sizes))
	ball_sizes.sort()
	n = len(ball_sizes)
	try:
		next((i for i in range(n - 2) if ball_sizes[i + 2] - ball_sizes[i] == 2))
		print('YES')
	except StopIteration:
		print('NO')
main()


n = int(input())
l = list(map(int, input().split()))
l.sort()
flag = 0
for i in l:
	if i + 1 in l and i + 2 in l:
		print('YES')
		flag = 1
		break
if flag == 0:
	print('NO')


n = int(input())
t_list = list(map(int, input().split()))
t_list.sort()
t_list = list(set(t_list))
t_list.sort()
hit = False
for i in range(0, len(t_list) - 2):
	if t_list[i] != t_list[i + 1] and abs(t_list[i] - t_list[i + 1]) <= 2 and (t_list[i] != t_list[i + 2]) and (abs(t_list[i] - t_list[i + 2]) <= 2) and (t_list[i + 1] != t_list[i + 2]) and (t_list[i + 1] - t_list[i + 2] <= 2):
		print('YES')
		hit = True
		break
if hit is not True:
	print('NO')


num = int(input())
flag = False
balls = []
for x in input().split(' '):
	balls.append(int(x))
balls.sort()
cont = 1
for i in range(0, num - 1):
	j = i + 1
	m = i + 2
	if balls[i] == balls[j]:
		m += 1
	elif balls[j] - balls[i] <= 1 and balls[i] != balls[j]:
		cont += 1
	else:
		cont = 1
	if cont == 3:
		flag = True
		break
if flag:
	print('YES')
else:
	print('NO')


from sys import stdin
inFile = stdin
tokens = []
tokens_next = 0

def next_str():
	global tokens, tokens_next
	while tokens_next >= len(tokens):
		tokens = inFile.readline().split()
		tokens_next = 0
	tokens_next += 1
	return tokens[tokens_next - 1]

def nextInt():
	return int(next_str())
from itertools import combinations
n = nextInt()
a = [nextInt() for i in range(n)]
for p in combinations(a, 3):
	if max(p) - min(p) <= 2 and len(set(p)) == 3:
		print('YES')
		exit()
print('NO')


n = int(input())
l = set(map(int, input().split()))
l = list(l)
l = sorted(l)
f = True
for i in range(len(l) - 2):
	if l[i] == l[i + 1] - 1 == l[i + 2] - 2:
		print('YES')
		f = False
		break
if f:
	print('NO')


def bin(arr, n):
	l = 0
	r = len(arr) - 1
	while l <= r:
		m = (l + r) // 2
		if arr[m] == n:
			return True
		elif arr[m] < n:
			l = m + 1
		else:
			r = m - 1
	return False
n = int(input())
arr = [int(i) for i in input().strip().split()]
arr.sort()
b = True
for i in arr:
	if bin(arr, i + 1) and bin(arr, i + 2):
		print('YES')
		b = False
		break
if b:
	print('NO')