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