The only bulbs that will be 'on' after all passes are completed will be the perfect squares. So, we just find however many perfect squares there are that are <= n:

```
class Solution(object):
def bulbSwitch(self, n):
"""
:type n: int
:rtype: int
"""
i = 1
while i ** 2 <= n:
i += 1
return i - 1
```