#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector <int> arr;
int val, siz;
cin >> siz;
for (int x = 0; x < siz; x++)
{
cin >> val;
arr.push_back(val);
}
int ind = 0;
for (int x = 0; x < siz-1; x++)
{
if (arr.at(x) > arr.at(x + 1))
{
arr.at(x) += arr.at(x + 1);
ind = x + 1;
arr.erase(arr.begin() + ind);
siz -= 1;
x--;
}
}
for (int x = 0; x < siz; x++)
{
cout << arr.at(x) << " ";
}
}