Function to return the minimum possible value of the last element left after performing the given operations
static int getMin ( int arr [ ] , int n ) { int minVal = Arrays . stream ( arr ) . min ( ) . getAsInt ( ) ; return minVal ; }