N = int(input()) print("YES" if N % 6 == 0 or N < 6 else "NO")