A = int(input()) for i in range(3, 10**5): if A-i*(i-1)//2>=0 and (A-i*(i-1)//2)%i==0: print('YES') exit() print('NO')