Minimum number of bits of array elements required to be flipped to make all array elements equal

import java.io.*;import java.lang.*;import java.util.*;class GFG{static int makeEqual(int arr[], int n){             int fre0[] = new int[33];        int fre1[] = new int[33];        for(int i = 0; i < n; i++)    {        int x = arr[i];                for(int j = 0; j < 33; j++)        {                        if ((x & 1) != 0)            {                                                 fre1[j] += 1;            }                        else            {                                                 fre0[j] += 1;            }                        x = x >> 1;        }    }        int ans = 0;        for(int i = 0; i < 33; i++)    {                         ans += Math.min(fre0[i], fre1[i]);    }            return ans;}public static void main(String[] args){    int arr[] = { 3, 5 };    int N = arr.length;         System.out.print(makeEqual(arr, N));}}