AT_past20_m 結合の中央値

Description

You are given a length- $ N $ sequence of positive integers $ A=(A_1,A_2,\dots,A_N) $ . Among the $ N(N-1) $ integers (including duplicates) obtained by choosing two distinct elements from $ A $ and concatenating them as strings, find the median, or the $ \left( N(N-1)/2 \right) $ -th smallest value.

Input Format

The input is given from Standard Input in the following format: > $ N $ $ A_1 $ $ A_2 $ $ \dots $ $ A_N $

Output Format

Print the answer.

Explanation/Hint

### Sample Explanation 1 By choosing two distinct elements from $ A=(1, 23, 45) $ and concatenating them as strings, six integers can be obtained: $ (123, 145, 231, 451, 2345, 4523) $ . Print the $ 3 $ -rd smallest integer $ 231 $ . ### Sample Explanation 2 By choosing two distinct elements from $ A=(2, 2, 4) $ and concatenating them as strings, six integers can be obtained: $ (22, 22, 24, 24, 42, 42) $ . Print the $ 3 $ -rd smallest integer $ 24 $ . ### Sample Explanation 3 Note that the answer may not fit into a 32-bit integer type. ### Constraints - $ 2 \leq N \leq 2 \times 10^5 $ - $ 1 \leq A_i \leq 10^8 $ - All input values are integers.