public int count(int l, int r) {
        int count = 0;
        for (Integer palindromePrime : palindromePrimesList) {
            if (palindromePrime < l) {
                continue;
            }
            if (palindromePrime >= l && palindromePrime <= r) {
                count++;
            } else {
                return count;
            }
        }
        return count;
    }