func_code_string: #include <bits/stdc++.h>   using namespace std;   int dp[1000000 + 10], cnt[1000000 + 10];   int n;   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       int a;       scanf( %d , &a);       int t = 0, temp = a;       while (temp <= 1e6) {         dp[temp] += t;         cnt[temp]++;         t++;         temp = (temp << 1);       }       t = 0;       while (a) {         if (a & 1 && a != 1) {           int nt = t + 2, temp = a - 1;           while (temp <= 1e6) {             dp[temp] += nt;             cnt[temp]++;             nt++;             temp = (temp << 1);           }         }         t++;         a = (a >> 1);         dp[a] += t;         cnt[a]++;       }     }     int ans = 0x3f3f3f3f;     for (int i = 1; i <= 1e6; i++) {       if (cnt[i] == n) ans = min(ans, dp[i]);     }     printf( %d n , ans);     return 0;   }   