#K67327. Find Repeated Elements

    ID: 32618 Type: Default 1000ms 256MiB

Find Repeated Elements

Find Repeated Elements

Given an array of integers, your task is to identify all the elements that appear more than once and output them in ascending order.

An element is considered repeated if its count is greater than 1, i.e. \(\text{count}(x) > 1\).

The input is given via STDIN. The first line contains a non-negative integer \(n\), which indicates the number of elements in the array. The second line contains \(n\) space-separated integers.

The output should consist of the repeated elements sorted in ascending order and printed on a single line, separated by a single space. If there are no repeated elements, output an empty line.

inputFormat

The first line contains a non-negative integer \(n\) denoting the number of elements in the array.

The second line contains \(n\) space-separated integers.

outputFormat

Print the repeated elements in ascending order separated by a single space. If no elements are repeated, print an empty line.

## sample
10
4 5 6 6 7 8 8 8 9 10
6 8