class Solution {
public:
    int countPrimeSetBits(int left, int right) {
        string bin("10100010100010101100");
        int mask = stoi(bin, nullptr, 2);
        int res = 0;
        for (int i = left; i <= right; i++) {
            if ((1 << __builtin_popcount(i)) & mask) res++;
        }
        return res;
    }
};