Chare Arrays: Odd-Even Sort Exercise

A mainchare has a chare array of size N. Each chare in the array generates its own random number. The array must be sorted in N steps, where at each step, each chare may communicate with at most one of its neighbors (i.e. on an 'odd' step adjacent chares are paired in one fashion, and on an 'even' step the pairing is switched). No barriers are allowed, and there is only one reduction, at the end, which checks that the elements have been properly sorted.

N is a command line parameter.