eolymp
bolt
Try our new interface for solving problems
Problems

Выпуклая оболочка

Выпуклая оболочка

There are n points on the plane. Build their convex hull. It is guaranteed that the convex hull is non-degenerate.

Input

The first line contains the number of points n (3n105). Each of the next n lines contains pair of integers xi and yi (-109xi, yi109) - the points coordinates.

Be careful! The points are random. The points can be identical, can lie on a straight line, and there is a lot of them.

Output

В первой строке выведите количество вершин n выпуклой оболочки. Следующие n строк должны содержать координаты вершин в порядке обхода. Никакие три подряд идущие точки не должны лежать на одной прямой.

Time limit 1 second
Memory limit 122.17 MiB
Input example #1
5
0 0
2 0
0 2
1 1
2 2
Output example #1
4
0 0
0 2
2 2
2 0