Finding the result with given condition
double res = ( Math . Pow ( 2 , i ) - 1 ) * ( Math . Pow ( 2 , j ) - 1 ) * Math . Pow ( 2 , n - i - j ) ; return res ; } static int count ( int [ ] arr , int value ) { int sum = 0 ; for ( int i = 0 ; i < arr . Length ; i ++ ) if ( arr [ i ] == value ) sum ++ ; return sum ; }