a = int(input()) for i in range(int(a/3)): if 3*i + 3 == a: print("YES") exit() print("NO")