public int trailingZeroes(int n) {
        int fives = 0;
        for (int i = 1; i <= n; i++) {
            int num = i;
            while (num % 5 == 0) {
                fives += 1;
                num /= 5;
            }
        }
        return fives;
    }