#include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
if(n < 1)
{
cout << "Please verify the number of students is larger than zero !" << endl;
return 0;
}
else if(1 == n || 2 == n)
{
cout << "The No." << n << " student is left at last. "<<endl;
return 0;
}
int array[n];
for(int i = 0 ; i < n; i++)
array[i] = i+1;
int index = 2;
int cont = 0;
while(cont < n-1)
{
array[index] = 0;
cont++;
for(int j = 0 ; j < 3; j++)
{
index++;
if(index >= n) index = index-n;
while(0 == array[index])
{
index++;
if(index >= n) index = index-n;
}
}
}
for(int i = 0 ; i < n ; i++)
{
if(0 != array[i])
cout << "The No." << array[i] << " student is left at last. " <<endl;
}
return 0;
}