#include <algorithm>
void exchange(unsigned & x, unsigned & y) {
unsigned t = x;
x = y;
y = t;
}
void sort(unsigned * a, int n) {
int m = n / 2;
for (int i = n - 1; i > m; i--) {
for (int j = 0; j < i; j++) {
if (a[j] > a[j + 1]) {
std::swap(a[j], a[j + 1]);
}
}
}
for (int i = m; i > 0; i--) {
for (int j = 0; j < i; j++) {
if (a[j] > a[j + 1]) {
std::swap(a[j], a[j + 1]);
}
}
}
}