@staticmethod
def c():
    (n, *ng) = map(int, sys.stdin.read().split())
    ng = set(ng)
    if (n in ng):
        print('NO')
    else:
        r = 100
        while (n > 0):
            if (r == 0):
                print('NO')
                return
            for i in range(3, 0, (- 1)):
                if ((n - i) in ng):
                    continue
                n -= i
                r -= 1
                break
            else:
                print('NO')
                return
        print('YES')
@staticmethod
def c():
    (n, *ng) = map(int, sys.stdin.read().split())
    ng = set(ng)
    if (n in ng):
        print('NO')
    else:
        r = 100
        while (n > 0):
            if (r == 0):
                print('NO')
                return
            for i in range(3, 0, (- 1)):
                if ((n - i) in ng):
                    continue
                n -= i
                r -= 1
                break
            else:
                print('NO')
                return
        print('YES')