October 7 - BMTK Programming School, High League
Let f(n) be the greatest odd divisor of n, where n is a positive integer. You are given a positive integer n. Find the sum f(1) + f(2) + ... + f(n).
Each line contains one positive integer n (n ≤
For each value of n print in a separate line the value of f(1) + f(2) + ... + f(n).
7 1 777
21 1 201537