Min Calls to Target Array

Starting from a zero-filled array, reach a target array using two operations: increment any element by 1, or double all elements. The minimal operations equal the total popcount of all numbers plus the highest bit position across all numbers.

Examples
Input: [1,5]
Output: 5
Hints

Min Calls to Target Array

Starting from a zero-filled array, reach a target array using two operations: increment any element by 1, or double all elements. The minimal operations equal the total popcount of all numbers plus the highest bit position across all numbers.