function v = f(v)
v(mod(v, 2) == 1) = sort(v(mod(v, 2) == 1));
v(mod(v, 2) == 0) = flip(sort(v(mod(v, 2) == 0))) / 2;
end
f([0 9 8 4 6 5 1 2 7 3])
ZnVuY3Rpb24gdiA9IGYodikKCXYobW9kKHYsIDIpID09IDEpID0gc29ydCh2KG1vZCh2LCAyKSA9PSAxKSk7Cgl2KG1vZCh2LCAyKSA9PSAwKSA9IGZsaXAoc29ydCh2KG1vZCh2LCAyKSA9PSAwKSkpIC8gMjsKZW5kCmYoWzAgOSA4IDQgNiA1IDEgMiA3IDNdKQ==