Problem description

Little Chris is bored during his physics lessons (too easy), so he has built a toy box to keep himself occupied. The box is special, since it has the ability to change gravity.

There are n columns of toy cubes in the box arranged in a line. The i-th column contains ai cubes. At first, the gravity in the box is pulling the cubes downwards. When Chris switches the gravity, it begins to pull all the cubes to the right side of the box. The figure shows the initial and final configurations of the cubes in the box: the cubes that have changed their position are highlighted with orange.

Given the initial configuration of the toy cubes in the box, find the amounts of cubes in each of the n columns after the gravity switch!

Input

The first line of input contains an integer n (1 ≤ n ≤ 100), the number of the columns in the box. The next line contains n space-separated integer numbers. The i-th number ai (1 ≤ ai ≤ 100) denotes the number of cubes in the i-th column.

Output

Output n integer numbers separated by spaces, where the i-th number is the amount of cubes in the i-th column after the gravity switch.

Examples

Input

4
3 2 1 2

Output

1 2 2 3 

Input

3
2 3 8

Output

2 3 8 

Note

The first example case is shown on the figure. The top cube of the first column falls to the top of the last column; the top cube of the second column falls to the top of the third column; the middle cube of the first column falls to the top of the second column.

In the second example case the gravity switch does not change the heights of the columns.

解题思路:升序排列并输出,水过!

AC代码:

 #include<bits/stdc++.h>
using namespace std;
int main(){
int n,a[];
cin>>n;
for(int i=;i<n;++i)cin>>a[i];
sort(a,a+n);
for(int i=;i<n;++i)
cout<<a[i]<<(i==n-?"\n":" ");
return ;
}

最新文章

  1. C库函数使用与总结之字符串处理函数
  2. ​Si2151/41 6th Generation Silicon TV Tuner ICs
  3. rabiitmq集群完整安装
  4. Jquery实现购物车物品数量的加减特效
  5. 我的Android开发相关文章
  6. leetcode第七题Reverse Integer (java)
  7. 谈论C++当然结果
  8. Oracle的sql语句中case关键字的用法 &amp; 单双引号的使用
  9. js控制html5 audio的暂停、播放、停止
  10. mysql允许远程IP访问
  11. 读改善c#代码157个建议:建议10~12
  12. C# 定时器传值问题详解
  13. shell脚本交互:expect学习笔记及实例详解
  14. 201521123062《Java程序设计》第8周学习总结
  15. 如何解决开机出现Missing operating system的故障
  16. 问题:win7下配置好服务器就是不能查询数据库。(已解决)
  17. Java知多少(70)面向字节流的应用
  18. Android Call(打电话)的基本知识详解
  19. UINavigationItem 设置UIBarButtonItem
  20. 电子数据识别软件ABBYY FineReader

热门文章

  1. CAD在网页中打印的图纸里面添加页眉及页脚
  2. js案例分析
  3. C++入职学习篇--代码规范(持续更新)
  4. 33.bucket与metric核心概念讲解
  5. Flask - 内置Session
  6. SVG格式图片转成HTML中SVG的Path路径
  7. printf 打印字符串的任意一部分
  8. 【ACM】nyoj_47_过桥问题_201308151616
  9. pt-osc改表导致数据不一致案例分析
  10. [转]C#综合揭秘——深入分析委托与事件