Traversing the 2d binary representation . 0 th index represents 32 th bits while 32 th index represents 0 th bit .
for ( long long i = 0 ; i <= 32 ; ++ i ) { int cnt = 0 ; for ( int j = 0 ; j < n ; ++ j ) { if ( bits [ j ] [ i ] and f [ j ] ) { cnt ++ ; } }