Numbers On A Whiteboard


Submit solution

Points: 10
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

There are \(N\) positive integers on the whiteboard, the \(i\)-th of which is \(A_i\).

You can perform a operation on these numbers. You can pick two integers, \(x\) and \(y\), such that they are both on the whiteboard and \(x \lt y\) and then write \(y - x\) on the whiteboard.

You wonder what are the minimum and maximum numbers that can appear on the whiteboard after some number of operations.

Satisfy your curiosity!

Constraints

\(1 \le N \le 10^5\)

\(1 \le A_i \le 10^9\)

Input Specification

The first line contains an integers \(N\), which is the number of integers on the whiteboard.

The next line contains \(N\) space-separated integers, \(A_i\), the integers on the whiteboard.

Output Specification

Output the minimum and maximum numbers, that can appear on the whiteboard after some number of operations.

Sample Input

4
2 3 3 5

Sample Output

1 5

Explanation

Write \(3 - 2\), which is \(1\) on the board. It can be shown that \(1\) is the minimum number possible.

It can also be shown that \(5\) is the maximum number possible.


Comments

There are no comments at the moment.