#include <bits/stdc++.h>

//end
int main() {
    long long int g;
    std::cin >> g;
    double rez = std::sqrt((double)2) * std::sqrt((double)(g + 1));
    long long int maz = (long long int)rez + 1;
    for (long long int u = maz; u >= 1; u--) {
        if ((u + 1) * u / 2 <= g + 1) {
            std::cout << g - u + 1 << std::endl;
            break;
        }
    }
}
//end
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m;
signed main(){
    cin>>n;
    int x=sqrt((n+1)<<1);
    if(x*(x+1)>((n+1)<<1)) x--;
    cout<<n-x+1<<endl;
    return 0;
}