#include <stdio.h> #include <stdlib.h> int compare(const void* a, const void* b) { return (*(int*)a - *(int*)b); } int main() { int n; if(scanf("%d", &n) != EOF) { if(n == 0) { printf("0\n"); return 0; } int* a = (int*)malloc(sizeof(int) * n); for(int i = 0; i < n; i++) { scanf("%d", &a[i]); } qsort(a, n, sizeof(int), compare); int min = a[0]; int count = 0; for(int i = 0; i < n; ++i) { while(a[i] != min) { a[i] /= 2; count++; if(a[i] < min) { min = a[i]; i = 0; } } } printf("%d\n", count); free(a); } else { printf("no input\n"); } }