XOR
题号:NC15830
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
64bit IO Format: %lld

题目描述

Once there was a king called XOR, he had a lot of land. Because of his name, he likes to play XOR games.

One day, he whimpered and wanted to establish N cities on that vast expanse of land, numbered 0, 1, 2..., N-1. He wanted to connect all the cities. If city A can reach City B through zero or one or several cities, then A and B are connected. The cost of repairing a road in City A and City B is the XOR value of number of City A and number of City B. This King XOR wanted to figure out the minimum cost for connecting all of the N cities.

Of course, like a fairy tale read as a child, there will be corresponding rewards after helping the king. If you help the king solve his problems, he will improve your ranking in the competition.

输入描述:

There are multi test cases
each test cases contains an integer N (2 ≤N≤ 20000), the number of cities the king wants to establish.

输出描述:

For each test case, print the minimum cost for connecting all of the N cities in one line.
示例1

输入

复制
4

输出

复制
4

说明

The weightof the minimum cost is 1+2+1=4 In the Sample Example.