loop to iterate through all the elements of the array and update sum
for ( $ j = 0 ; $ j < $ n ; $ j ++ ) { $ sum += ( $ mul * $ c_odd ) ; if ( ( $ arr [ $ j ] & ( 1 << $ i ) ) > 0 ) $ c_odd = ( $ n - $ j - $ c_odd ) ; }