Check if it is possible to make the array and there are n - 1 pairs whose sum will be equal to s1
if ( c < n - 1 && isArrayPossible == false ) { System . out . println ( "0" ) ; } else { System . out . println ( ans ) ; } }