n = int(input()) print("YES" if (n%3 == 0 and n != 3) else "NO")