Problem

2 /21


Number lengths

Problem

Let's call the length of a number the number of digits in its decimal notation. For example, the length of 2017 is 4, and the length of 7 is 1. Given a set of N non-negative integers, each less than 109.
It is necessary to determine the numbers of what length are least likely (but not less than once) in this set and how many numbers of this length are in it. If numbers of different lengths occur equally often (and less frequently than numbers of any other length), choose the shorter length.
Write a time and memory efficient program to solve this problem.

Description of input and output data
The first line of the input specifies the number of numbers N (\(1 <= N <= 10000\)). Each of the following N lines contains one non-negative number not exceeding 109.
Sample input:
5
12
417
125
327
4801
Sample output for the example input above:
2 1
In this set, numbers of length 2 and 4 are least often (once 1 each).