import java.math.BigInteger;

public class Euler647 {

    static long isqrtU64(long n) {
        if (n < 0)
            return 0;
        long r = (long) Math.sqrt(n);
        while ((r + 1) * (r + 1) <= n)
            r++;
        while (r * r > n)
            r--;
        return r;
    }

    static long floorSqrtU128(BigInteger n) {
        if (n.signum() < 0)
            return 0;
        // BigInteger sqrt
        BigInteger rBig = n.sqrt();
        long r = rBig.longValue();
        return r;
    }

    static BigInteger Fk(int k, long N) {
        if ((k & 1) == 0 || k < 3)
            return BigInteger.ZERO;
        long d = k - 2;
        long c = (long) (k - 4) * (k - 4);

        long sqrtN = isqrtU64(N);
        if (sqrtN <= 1)
            return BigInteger.ZERO;

        long tA = (sqrtN - 1) / (2 * d);

        long M = (2 * N) / c;
        BigInteger bigD = BigInteger.valueOf(d);
        BigInteger bigM = BigInteger.valueOf(M);
        BigInteger disc = BigInteger.ONE.add(BigInteger.valueOf(4).multiply(bigD).multiply(bigM));

        long s = floorSqrtU128(disc);
        long tB = (s > 0) ? (s - 1) / (2 * d) : 0;

        long T = Math.min(tA, tB);
        if (T == 0)
            return BigInteger.ZERO;

        BigInteger TT = BigInteger.valueOf(T);
        BigInteger S1 = TT.multiply(TT.add(BigInteger.ONE)).divide(BigInteger.valueOf(2));
        BigInteger S2 = TT.multiply(TT.add(BigInteger.ONE))
                .multiply(TT.multiply(BigInteger.valueOf(2)).add(BigInteger.ONE)).divide(BigInteger.valueOf(6));

        BigInteger bigC = BigInteger.valueOf(c);

        BigInteger dS1 = bigD.multiply(S1);
        BigInteger d2S2 = bigD.multiply(bigD).multiply(S2);

        BigInteger sumA = TT.add(dS1.multiply(BigInteger.valueOf(4))).add(d2S2.multiply(BigInteger.valueOf(4)));
        BigInteger sum_dt2_t = bigD.multiply(S2).add(S1);
        BigInteger sumB = bigC.multiply(sum_dt2_t.divide(BigInteger.valueOf(2)));

        return sumA.add(sumB);
    }

    static BigInteger sumAll(long N) {
        BigInteger ans = BigInteger.ZERO;
        for (int k = 3;; k += 2) {
            long d = k - 2;
            long c = (long) (k - 4) * (k - 4);
            long A1 = (2L * k - 3) * (2L * k - 3);
            long B1 = c * (long) (k - 1) / 2;

            // In Java, we should check overflow. A1 and B1 fit in long easily since N is up
            // to 10^12
            // If they overflow long, they are definitely > N
            boolean brk = false;
            if (2L * k - 3 > 3000000 || A1 > N)
                brk = true;
            if (B1 > N)
                brk = true;
            if (brk)
                break;

            ans = ans.add(Fk(k, N));
        }
        return ans;
    }

    public static String solve() {
        long N = 1000000000000L;
        BigInteger ans = sumAll(N);
        return ans.toString();
    }

    public static void main(String[] args) {
        System.out.println(solve());
    }
}
