n = int(input())
x = n % 6 + 1
if x == 1:
    print('Yes')
else:
    print('No')