Boxes#8434

Boxes

1 second
128 megabytes
Easy

There are boxes. They are numbered with positive integers from to without repetitions. Additionally, an integer between and is written on the bottom of each box. Note that there can be several boxes with the same number written on them.

Let us define a move as the following sequence of actions:

  1. Choose any box and mark it as current.

  2. Remember the number written on the bottom and remove the box.

  3. If there exists a box with the number that has just been remembered, mark that box as current and go to step . Otherwise, the move is over.

Given the numbers written on the bottoms of the boxes you should determine what minimum and maximumnumber of moves one could possibly make to remove all the boxes.

Input

First line contains an integer ( ≤ ≤ 10^5). Each of the following lines contains one number. The -th of these lines contains the number written on the bottom of the -th box.

Output

Print two integers: the minimum and maximum number of moves.

Examples

Example 1

Loading
Loading