我果然智力有问题!

while(count = ~~readline()) {
    // 可以喝到的瓶数 res
    let res = 0;
    while(count > 1) {
        const swapCount = ~~(count / 3);
        res += swapCount;
        count = count % 3 + swapCount;
        if(count == 2) {
            res++;
            break;
        }
    }
    console.log(res);
}