#K83717. Library Report

    ID: 36260 Type: Default 1000ms 256MiB

Library Report

Library Report

You are given a list of ISBN numbers corresponding to the books checked out from a library. Your task is to determine two values:

  • The ISBN number that appears most frequently. In the case of a tie, output the smallest ISBN among those.
  • The total number of unique ISBN numbers.

Formally, let \(\mathcal{F}(x)\) be the frequency of ISBN \(x\). You need to find an ISBN \(x^*\) such that:

\[ x^* = \min \{ x \mid \mathcal{F}(x) = \max_{y}\mathcal{F}(y) \}\]

and also report \(U\), the count of unique ISBN values.

inputFormat

The first line contains an integer \(n\) representing the number of books checked out.

The second line contains \(n\) space-separated integers representing the ISBN numbers.

outputFormat

Output two integers separated by a space: the ISBN number that is the most frequently checked out (choosing the smallest in case of ties) and the count of unique ISBNs.

## sample
7
123 124 125 123 125 123 126
123 4