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