<a href="https://cses.fi/problemset/task/1137/">https://cses.fi/problemset/task/1137/</a>
Input Format
.
Output Format
.
Constraints
.
Notice
.
Example
Input
5 3 4 2 5 2 1 1 2 1 3 3 4 3 5 2 3 1 5 3 2 3
Output
8 10