William array n integer a_1 a_2 dot a_n in swap neighboring item two item a_i a_j consider neighboring condition j 1 satisfiedWilliam want calculate minimal number swap need perform array contain neighboring item parity