const
nhap='tong.inp';
xuat='tong.out';
var
i,s,Q:longint;
begin
assign(input,nhap); reset(input);
assign(output,xuat); rewrite(output);
read(Q);
s:=0; i:=1;
while s<Q do
begin
s:=s+i;
i:=i+1;
end;
if s>Q then s:=s-i+1;
write(s);
close(input); close(output);
end.