#include <iostream>
using namespace std;

int main() {
	int n, s[1000], aux;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> s[i];
	}
	for (int i = 1; i < n; i++) {
		for (int j = i + 1; j <= n; j++) {
		if (s[i] % 100 == s[j] % 100) {
			if (s[i] > s[j]) {
				aux = s[i];
				s[i] = s[j];
				s[j] = aux;
			}
		} else if (s[i] % 100 > s[j] % 100) {
				aux = s[i];
				s[i] = s[j];
				s[j] = aux;
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		cout << s[i] << " ";
	}
	return 0;
}