#include<iostream.h> #include<math.h> void main() { int n,k,d; cin>>n; d=1+8*n; k=(-1+sqrt(d))/2; if(k*(k+1)/2==n) cout<<1; else{ k++; cout<<1+k*(k+1)/2-n; } }