#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
using namespace std;
int n, buf;
vector<int> a;
int main()
{
fstream fin;
fin.open("input.txt");
fin >>n;
a.reserve(n);
for (int i=0; i<n; ++i)
{
fin >> buf;
a.push_back(buf);
}
sort(a.begin(), a.end());
for (int i=0; i<n; ++i) cout << a[i] <<' ';
cout <<endl <<a.size();
fin.close();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnN0cmVhbT4KI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPHZlY3Rvcj4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbiwgYnVmOwp2ZWN0b3I8aW50PiBhOwoKaW50IG1haW4oKQp7CiAgICBmc3RyZWFtIGZpbjsKICAgIGZpbi5vcGVuKCJpbnB1dC50eHQiKTsKICAgIGZpbiA+Pm47CiAgICBhLnJlc2VydmUobik7CiAgICBmb3IgKGludCBpPTA7IGk8bjsgKytpKQogICAgewogICAgICAgIGZpbiA+PiBidWY7CiAgICAgICAgYS5wdXNoX2JhY2soYnVmKTsKICAgIH0KICAgIHNvcnQoYS5iZWdpbigpLCBhLmVuZCgpKTsKICAgIGZvciAoaW50IGk9MDsgaTxuOyArK2kpIGNvdXQgPDwgYVtpXSA8PCcgJzsKICAgIGNvdXQgPDxlbmRsIDw8YS5zaXplKCk7CiAgICBmaW4uY2xvc2UoKTsKICAgIHJldHVybiAwOwp9Cg==