P27865 [洛谷] [NICA #2] Love or Not
普及+
题目描述

Problem Background

Is it love or dislike, is it love or dislike
Lalala~
Struggling along, struggling along
Lalalala~

Problem Description

Xiao Ran has a sequence of positive integers \( a \) of length \( n \). She can perform the following operation any number of times (including zero):

  • Choose two distinct indices \( i, j \) ( \( 1 \le i, j \le n \) ), then divide \( a_i \) by 2 and take the floor, and multiply \( a_j \) by 2. The resulting \( a_i \) must be a positive integer.

Xiao Ran wants to minimize the sum of the sequence. Output the sum of the final sequence after performing the operations.

Input Format

The first line contains a positive integer \( n \), representing the length of the sequence.

The second line contains \( n \) positive integers separated by spaces, representing \( a_i \).

Output Format

A single integer representing the sum of the final sequence after the operations.

Sample Input and Output

Sample Input #1

5
1 2 3 4 5

Sample Output #1

12

Sample Input #2

6
1 1 4 5 1 4

Sample Output #2

12

Notes

The data guarantees that \( 2 \le n \le 10^5 \) and \( 1 \le a_i \le 10^9 \).

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 1 2 3 4 5
样例输出
12