/*
Author : Aditya Gupta
Team : TechTurtle
Date : 29-08-2020
Time : 20:05:54
*/


#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define vll vector<ll>
#define vvll vector< vll >
#define vld vector< ld >
#define vvld vector< vld >
#define pll pair<ll ,ll >
#define vpll vector< pll >
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define endl "\n"
#define flash ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test ll t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define fst first
#define scd second
#define mk(arr,n,type)  type *arr=new type[n];


#define forn(i,n) for(ll (i) = 0 ; (i) < (n) ; ++(i))
#define for1(i,n) for(ll (i) = 1 ; (i) <= (n) ; ++(i))
#define forr(i,n) for(ll (i) = (n)-1 ; (i)>=0 ; --(i))
#define forab(i,a,b,c) for(ll (i) = a ; (i) <= (b) ; (i)+=(c))

using namespace std;

///////////////////////////////////////////////////////////////////////// Maths //////////////////////////////////////////////////////////////////////////////

//vll sieve;
//void Sieve(int N){  //smallest prime factor
//	const ll maxn = N;
//	sieve.resize(maxn);
//	forn(i,maxn) sieve[i] = i;
//	sieve[1] = -1;
//	sieve[0] = -1;
//	forab(i,2,maxn,1) if(i == sieve[i]) for(ll j = i*i ; j < maxn ; j+=i) if(sieve[j] == j) sieve[j] = i;
//
////	for(auto i:sieve){
////		cout<<i<<" ";
////	}
//
//}
vll sieve;
vll* Sieve(int N) {
	const ll maxn = N;
	sieve.resize(maxn);
	forn(i,maxn) sieve[i] = 1;
	sieve[1] = 0;
	sieve[0] = 0;
	forab(i,2,maxn,1) if(1 == sieve[i]) for(ll j = i*i ; j < maxn ; j+=i) sieve[j] = 0;

	vll* primes=new vll();
	primes->pb(2);
	for(int i=3; i<maxn; i+=2)
		if(sieve[i]) {
			primes->pb(i);
		}
	return primes;

}


ll extended_GCD(ll a , ll b , ll &x , ll &y) {
	if(a == 0) {
		x = 0;
		y = 1;
		return b;
	}
	ll x1 , y1;
	ll gcd = extended_GCD(b%a , a , x1 , y1);
	x = y1 - (b/a)*x1;
	y = x1;
	return gcd;
}

ll ncr(ll n,ll k) {
	ll r=1;
	if(k>n-k)
		k=n-k;
	for(ll i=0; i<k; i++) {
		r*=(n-i);
		r/=(i+1);
	}
	return r;
}


ll power(ll a, ll b,ll m = MOD) {
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a)%m;
		a = (a * a)%m;
		b >>= 1;
	}
	
	return res;
}

ll modinv(ll a , ll mod = MOD) {
	ll x , y;
	extended_GCD(a , mod , x , y);
	if(x < 0) x += mod;
	return x;
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool prime(int n) {
	int c=0;
	for(int i=2; (i*i)<=n; i++) {
		if(n%i==0) {
			c++;
			return false;
		}
	}
	if(c==0)
		return true;
}
// bool compareInterval(char i1, char i2)
//{
//    return (i1 < i2);
//}
// int countoperation(int n,m){
// 	vector<int> d<m+1,-1>;
// }
vector<int> v[200006];
int vis[200006];
int c;
int in[200006];
vector<int> res;

bool khan(int n){
	priority_queue<int,vector<int>,greater<int>> q;
	for(int i=1;i<=n;i++){
		if(in[i]==0)
		q.push(i);
	}
	
	while(!q.empty()){
		int curr=q.top();
		res.pb(curr);
		q.pop();
		
		for(int node:v[curr]){
			in[node]--;
			if(in[node]==0)
			q.push(node);
		}
	}
	
	return n==res.size();
	
}

void dfs(int n){
	vis[n]=1;
	cout<<n<<" ";
	for(int i:v[n]){
		if(!vis[i])
		dfs(i);
	}
	
}


void solve() {

ll n;
cin>>n;

ll s=0,i=1;

ll N=(n+1)*2;
ll x=((int)sqrt(1+4*N)-1)/2;

while((x+2)*(x+1)/2<=n+1)
x++;

cout<<n-x+1<<"\n";

}

int main() {
	flash
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);

//	test
	solve();
	return 0;
}
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;i++)
#define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;i--)
#define erep(i,j) for(int i=hd[j];i;i=nxt[i])
inline int read(){
	int x=0,f=1;char c=getchar();
	while(c<48||c>57){if(c=='-')f=-1;c=getchar();}
	while(c>=48&&c<=57)x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return x*f;
}

using namespace std;
const int M=1e6+5;
int mob[M],vis[M],cnt[M];
int E[M*20],hd[M*20],nxt[M*20];
int tot;
void add(int a,int b){
	E[++tot]=b,nxt[tot]=hd[a];
	hd[a]=tot;
}
long long que(int l,int r){
	long long ans=0;
	rep(i,1,r)cnt[i]=0;
	rep(i,l,r){
		erep(j,i){
			int t=E[j];
			ans+=cnt[t];
			cnt[t]+=mob[t];
		}
	}
	return ans;
}
int main() {
	int L=read(),R=read();
	rep(i,1,M-1)mob[i]=1;
	rep(i,2,M-1){
		if(vis[i])continue;
		mob[i]=-1;
		for(int j=i+i;j<M;j+=i){
			vis[j]=1;
			if(j/i%i==0)mob[j]=0;
			else mob[j]=-mob[j];
		}
	}
	rep(i,1,M-1)for(int j=i;j<M;j+=i)add(j,i);
	long long ans=0;
	rep(i,2,M-1){
		int mi=2e9,mx=-2e9;
		for(int j=i+i;j<M;j+=i)if(j>=L&&j<=R)mi=min(mi,j/i),mx=max(mx,j/i);
		if(mi<=mx)ans+=que(mi,mx);
	}
	printf("%lld\n",ans*2);
	return 0;
}