Strength

Time limit: 1s Memory limit: 256MB Input: Output:

"More isn't always better. Sometimes it's just more." — Barbara Benedek

In a small Romanian village called Iași, the peaceful life of its inhabitants is threatened by a relentless wave of dark creatures. To defend their home, each villager is ready to fight and their strength is known (a positive integer).

Initially, all villagers are part of the army. In one operation you can remove exactly one villager from the army.

The overall strength of the army is defined as the bitwise AND of the strengths of all remaining villagers.

The bitwise AND of multiple bits is 11 if all bits are 11, and 00 otherwise. The bitwise AND of multiple numbers is obtained by performing the bitwise AND for each coresponding bit position. For example, 11 AND 13 AND 5=1011(2) AND 1101(2) AND 0101(2)=0001(2)=111 \text{ AND } 13 \text{ AND } 5 = 1011_{(2)} \text{ AND } 1101_{(2)} \text{ AND } 0101_{(2)} = 0001_{(2)} = 1.

Task

Determine the minimum number of operations required to maximize the overall strength of the army.

Input data

The first line contains an integer nn — the population of the village.

The second line contains nn positive integers — the strengths of each villager.

Output data

On the first line, print the minimum number of operations required.

Constraints and clarifications

  • 1n100 0001 \le n \le 100\ 000
  • The villagers' strengths are integers between 11 and 10910^9.

Example

stdin

3
1 5 4

stdout

2

Log in or sign up to be able to send submissions!