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