Condition for only one swap
else if ( ( last_val == 0 && second_last_val % 2 != 0 ) || ( last_val % 2 == 0 && second_last_val == 0 ) ) Console . WriteLine ( 1 ) ; else if ( == true && ( == 0 && second_last_val % 2 != 0 ) ) Console . WriteLine ( 1 ) ;