require "big" lib C fun getchar_unlocked : Int32 end def read_i : Int64 ans = 0_i64 f = 1 c = C.getchar_unlocked() while [9, 10, 11, 12, 13, 32].includes?(c) c = C.getchar_unlocked() end if c == 45 f = -1 c = C.getchar_unlocked() end while (48 .. 57).includes?(c) ans = (ans << 1_i64) + (ans << 3_i64) + (c ^ 48).to_i64 c = C.getchar_unlocked() end return ans * f.to_i64 end def work(n : Int64) l = 0_i64 r = 3001001001_i64 while l + 1_i64 < r m = (l + r) >> 1_i64 if m * (m + 1_i64) >> 1_i64 > n r = m else l = m end end if l * (l + 1_i64) >> 1_i64 == n puts("YES") puts(l) else puts("NO") end end work(read_i)