a = int(input()) is_yes = 0 for i in range(3,int(pow(a,0.5)+100)): if (a - i*(i-1)//2) < 0: break if (a - i*(i-1)//2)%i == 0: is_yes = 1 break if is_yes: print("YES") else: print("NO")