function countUnblockedIPs(ranges) {
const maxIP = 4294967295;
let [ip, unblocked] = [0, 0];
for (const [start, end] of ranges) {
if (ip < start) {
unblocked += start - ip;
}
ip = Math.max(ip, end + 1);
}
if (ip <= maxIP) {
unblocked += maxIP - ip + 1;
}
return unblocked;
}