Problem B - FILM FESTIVAL ------------------------- The Interplanetary Film Festival is thinking of implementing a new idea next year. When people stand in line to buy a ticket, the ticket-seller will ask each person for his or her birthday. The first person in the line whose birthday is the same as someone who bought a ticket earlier gets a free ticket. For example, if the birthdays of the people in line are: Mar 21, Mar 27, Dec 29, Mar 3, Mar 27, Aug 24, Dec 29, Jun 12, Oct 13 then the fifth person in line will receive a free ticket (since that person has the same birthday as the second person in line). The seventh person in line will not receive a free ticket (even though his birthday matches the third person's) because the free ticket was already given away to the fifth person. Each year the festival is held on a different planet. If the planet's year has N days, which position in line has the best chance of yielding a free ticket? (If there are two positions tied for the optimum, give the first such position.) For simplicity, assume that all days of the year are equally likely as birthdays. Also ignore leap years, i.e. assume no one is born on Feb 29. Input Format ------------ The input will contain multiple instances. Each instance will contain a single integer on a separate line indicating the value of N. The end of the input is indicated by a line containing 0. Output Format ------------- Each instance should generate one line of output giving the position number with the best chance of winning a free ticket. Sample Input ------------ 365 13 0 Sample Output ------------- 20 5