Running loop from p times which is the number of bits required to represent all the elements of the array
int X = 0 ; for ( int i = 0 ; i < p ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < n ; j ++ ) {