30 pupils numbered from 1 to 30 were asked to queue in a straight line. The first pupil in the queue was asked to leave, the secomd pupil remained. The third pupil was asked to leave the queue, the fourth pupil remained and so fourth. This process was then repeated until there was only one pupil left in the queue. What was the number of the only pupil?