import math N = int(input()) k = (math.isqrt(8 * N + 1) - 1) // 2 print(N - k * (k + 1) // 2)