private import std.stdio;

void main() {
	int[] a = [1, 9, 4, 8, 9, 6, 3, 9, 5, 2];
	a.countingSort(1, 10);
	writeln(a);
}

void countingSort(int[] array, int min, int max) {
	auto counts = new uint[max - min + 1];
	foreach(n; array) {
		counts[n - min]++;
	}
	auto p = array.ptr;
	foreach(i, c; counts) {
		p[0..c] = i + min;
		p += c;
	}
}