if the bulb is on at end, then the number of this bulb must have odd factors. and only square number has odd fctors, so we only need to find the number of square number less than n;

then we only need 1 line and it is prtty easy

```
class Solution {
public:
int bulbSwitch(int n) {
return sqrt(n);
}
};
```