nun = int(input()) if (num + 1) % 6 == 0: print('Yes') else: print('No')