X = int(eval(input()))

ans = 0

for i in range(1,X+1):

    if ans + i <= X:

        ans += i

    else:

        print(i)

        exit()

    if ans == X:

        print(i)

        exit()
X = int(eval(input()))

ans = 0

for i in range(1,X+1):

    ans += i

    if X <= ans:

        print(i)

        exit()
X = int(eval(input()))
ans = 0
for i in range(1, X + 1):
    if ans + i <= X:
        ans += i
    else:
        print(i)
        exit()
    if ans == X:
        print(i)
        exit()

X = int(eval(input()))
ans = 0
for i in range(1, X + 1):
    ans += i
    if X <= ans:
        print(i)
        exit()

-    if ans + i <= X: -        ans += i -    else: +    ans += i +    if X <= ans: -    if ans == X: -        print(i) -        exit()