Run from i = 000. . 0 to i = 111. . 1 or check all possible subsets of the array
for ( int i = 1 ; i < ( 1 << n ) ; i ++ ) { long long mult = 1 ; for ( int j = 0 ; j < n ; j ++ ) if ( i & ( 1 << j ) ) mult *= a [ j ] ;