using namespace std; int main() { int k,i,t=1,sum=0,y,a[10001]; cin>>k; for(i=1;i<=k;i) { sum+=t;a[t]; if(t==a[t])t++; }cout<<sum; return 0; }