We are given a input array target[] containing n elements, we need to compute minimum number of operation from converting array[] of size n with all zeros to target[].

Operations

a) Increment an element by 1 is one operation.b) Double all the elements is one operation.

Example

a) Input: target array -> [1,1]

Output: 2,Increment 1 for both elements in [0, 0] to get [1, 1]-> 2 operations.

b) Input: target array -> [2, 2]

Output: 3,Increment 1 for both elements in [0, 0] to get [1, 1] -> 2 operations,Double all the elements in [1, 1] to get [2, 2] -> 1 operationTotal = 3

c) Input: target array -> [2,3]

Output: 4,Increment 1 for both elements in [0, 0] to get [1, 1] -> 2 operations,Double all the elements in [1, 1] to get [2, 2] -> 1 operationIncrement 1 for second element in [2, 2] to get [2, 3] -> 1 operation,Total = 4