eolymp
bolt
Try our new interface for solving problems
Məsələlər

Preparing for battle

Preparing for battle

The distinguished Marshal La Hsram considers the best fighting unit to be a squad, built in two ranks of equal size, led by a commander. Therefore, it must consist of an odd number of warriors. But on his call sometimes there are units with an even number of soldiers. Then he himself calls all the detachments with some even number of fighters q to the parade ground to carry out division operations. After the execution of his commands, these units are divided into two equal parts, one of which remains in his army, and the other is transferred to the reserve. Such operations are repeated until all units have an odd number of soldiers. Determine what is the smallest number of operations the marshal will have to do to keep the units with the desired composition. For example, if the initial composition of the units looks like: [22, 31, 52, 13, 26, 11, 26], then you can: build units with the number of soldiers q = 22, divide them, we get: [11, 31, 52, 13, 26, 11, 26]; then with q = 52, we have: [11, 31, 26, 13, 26, 11, 26]; and finally with q = 26: [11, 31, 13, 13, 13, 11, 13]. This will complete the reorganization in three steps.

Input

The program enters one natural number from the keyboard: N (from 5 to 10 ^ 6) - the number of units, and then in the next line N natural numbers from (11 up to 10 ^ 9) - number of units.

Output

On a single line, write the minimum number of division operations to perform the reorganization.

Zaman məhdudiyyəti 0.4 saniyə
Yaddaşı istafadə məhdudiyyəti 64 MiB
Giriş verilənləri #1
7
22 31 52 13 26 11 26
Çıxış verilənləri #1
3
Mənbə Dnipro Open School Olympiad in Informatics 2020