import math n = int(input()) m = int((math.sqrt(8 * n + 1) - 1) // 2) result = n - m * (m + 1) // 2 print(result)