At CMIMC headquarters, there is a row of n lightbulbs, each of which is connected to a light switch. Daniel the electrician knows that exactly one of the switches doesn’t work, and needs to find out which one. Every second, he can do exactly one of 3 things:
1. Flip a switch, changing the lightbulb from off/on or on/off (unless the switch is broken).
2. Check if a given lightbulb is on or off.
3. Measure the total electricity usage of all the lightbulbs, which tells him exactly how many are currently on.
Initially, all the lightbulbs are off. Daniel was given the very difficult task of finding the broken switch in at most n seconds, but fortunately he showed up to work 10 seconds early today. What is the largest possible value n such that he can complete his task on time?