n=int(input()) if (((n-1)%6)+1)%6: print("No") else: print("Yes")