This page is still under construction.

Parts of this page are still being built. What you see may change.

Counting Odd Binomial Coefficients

Time limit1sMemory limit256 MB

Summary
Count the pairs (m, k) with m below n whose binomial coefficient is odd.
Level

Medium7 of 10

Topics
Number theory, Bit manipulation, Recursion, Combinatorics
Solved
No attempts yet

Problem

For non-negative integers mm and kk with k≤mk \le m, the binomial coefficient is defined as (mk)=m!k!(m−k)!\binom{m}{k} = \frac{m!}{k!(m-k)!}. Let T2(n)T_2(n) be the number of pairs (m,k)(m, k) with 0≤k≤m<n0 \le k \le m < n such that (mk)\binom{m}{k} is odd. The following inequality holds.

0.812556 nlog⁡23≤T2(n)≤nlog⁡230.812556\,n^{\log_2 3} \le T_2(n) \le n^{\log_2 3}

Emma does not like an inequality that only brackets the answer, so she wants the exact value of T2(n)T_2(n). Help her compute it.

Input

The first line contains one integer nn (1≤n≤10111 \le n \le 10^{11}).

Output

Print the value of T2(n)T_2(n) on the first line.

Examples3

  1. Example 1

    Input
    4
    
    Expected output
    9
    
  2. Example 2

    Input
    6
    
    Expected output
    15
    
  3. Example 3

    Input
    1
    
    Expected output
    1