Duplicate Numbers

  1. Input a positive integer N, and then input N integers.
  2. Output duplicate integers in ascending order, and their occurrences.
  3. Example input:
    10
    1
    2
    3
    4
    1
    2
    3
    1
    2
    1
  4. Example output:
    1 4
    2 3
    3 2