#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n,k=1,x;
vector <int> a;
cin >> n;
while (a.size()<n)
{
x=k;
while (x)
{
a.push_back(x);
x--;
}
k++;
}
cout << a[n-1];
return 0;
}
var n,k,x:integer;
a:array [0..100000] of integer;
begin
read(n); k:=1;
while (a[0]<n) do
begin
x:=k; k:=k+1;
while (x>0) do
begin
a[0]:=a[0]+1;
a[a[0]]:=x;
x:=x-1;
end;
end;
write(a[n]);
end.