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

Starter code:

Solutions:
n = int(input())
a = sorted(list(set(map(int, input().split()))))

for i in range(2, len(a)):
    if a[i] - a[i - 2] <= 2:
        print('YES')
        break
else:
    print('NO')


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


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


#! /usr/bin/env python3

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


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


#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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()
#print(finish - start)


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

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


_ = input()

balls = sorted(list(set([int(x) for x in 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')


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

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)



#!/usr/bin/env python3
# -*- coding: utf-8 -*-


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


def __starting_point():
    main()

__starting_point()

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


def __starting_point():
  n = int(input())
  arr = list(map(int,input().split()))
  #cnt = 0
  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()

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 isGift2(a, b):
    return a != b and abs(a - b) <= 2


def isGift3(a, b, c):
    """
    >>> isGift3(1, 4, 7)
    False
    >>> isGift3(4, 3, 5)
    True
    >>> isGift3(30, 31, 32)
    True
    >>> isGift3(30, 31, 33)
    False
    """
    return isGift2(a, b) and isGift2(b, c) and isGift2(a, c)


def isGift(lst):
    """
    >>> isGift([18, 55, 16, 17])
    True
    >>> isGift([40, 41, 43, 44, 44, 44])
    False
    >>> isGift([5, 972, 3, 4, 1, 4, 970, 971])
    True
    """
    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)


def __starting_point():
    main()

__starting_point()

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
    ##print(cont)
    if(cont==3):        
        flag = True
        break
        
        
if(flag):
    print ("YES")
else:
    print ("NO")
##print("%d %d %d"%(balls[i],balls[j],balls[m]))


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 __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')


'''
    A = input()
    stack = []      #Real Stack
    Graph = {
        ')':'('
        }
    count = 0
    def black(A):
        #p for possibility
        stak =[]
        for e in A:
            if e in ['(']:
                stak.append(e)
            else:
                if stak==[] or Graph[e]!=stak[-1]:
                    p=False
                else:
                    stak.pop(len(stak)-1)     #pop last 
        if len(stak) ==0:
            p=True
        else:
            p=False
        if not p:   return [0]
        else:
            #stak is not empty
            stak = []
            count = []
            for e in range(len(A)):
                if A[e]=='(' or stak==[]:  stak.append(A[e])
                else:
                    if A[e]==')' and Graph[A[e]]==stak[-1]:
                        while Graph[A[e]]==stak[-1]:
                            stak.pop(-1)
                            if e==len(A)-1: break
                            e+=1
                            if A[e]=='(' or stak==[]:   break
                        count.append(1)
            return count

    rov = []
    P = False 
    for e in A:
        if e in ['(']:  stack.append(e)
        else:
            if stack!=[]:
                stack.append(e)
                if stack.count('(')==stack.count(')'):
                    x=black(stack)
                    if x!=[0]:    P = True
                    if x==[1]:
                        rov.append(1)
                    else:
                        rov.append(sum(x[:-1]))
                    stack=[]
    if not P:   print(0)
    else:
        pro =1
        for i in rov:   pro*=i
        print(pro)
    
'''

__starting_point()

n = int(input())
b = list(map(int, input().split()))
c = [0] * 1010

for i in range(len(b)):
    c[b[i]] = 1
for i in range(1, 999):
    if c[i] and c[i + 1] and c[i + 2]:
        print('YES')
        return
print('NO')

n=int(input())
sizes=sorted(list(set(map(int, input().split(' ')))))

def isThree(z):
    for i in range(2,len(z)):
        if abs(z[i-2]-z[i])<=2:
            return True
    return False

if isThree(sizes):
    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())
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())
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')
                return
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")