#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;

#define FOR(i,a,b) for(size_t i=(a); i<(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n+1)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const ll MOD=1000000007;

int main(void){
	ll n;
	cin >> n;
	
	if(n<=2){
	    cout << 1 << endl;
	    return 0;
	}
	
	ll sum=0,s=0;
	
	NREP(i,n){
		sum+=i;
		if(sum>(n+1)){
			s=i;
			break;
		}
	}
	
	cout << n-s+2 << endl;
	
}
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    vector<string> s;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        string temp;
        cin>>temp;
        s.push_back(temp);
    }
    long long int power[60];
    power[0] = 1;
    for(int i=1;i<=60;i++)
        power[i] = power[i-1] * 2;
    int length = s.size()-1;
    long long int ttl = 0;
    for(int i=length;i>=0;i--)
    {
        if(s[i][0] == 'O')
            ttl += power[i+1];
    }
    cout<<ttl+1<<"\n";
}