<a href="https://practice.geeksforgeeks.org/problems/morning-assembly3038/0/" target="_blank"><i class="fa fa-external-link" aria-hidden="true"> Link -> Tricky Sorting Cost</i></a>
Input Format
check the link
Output Format
check the link
Constraints
check the link
Example
Input
3 2 1 3
Output
1