Problem C
Cramming for Finals
It’s final exam season and Ashley is heading to her favorite library to cram for finals.
The library has a dedicated floor for studying where there
are
Because the floor is usually very quiet, it is possible to
hear sounds from other students who are nearby – for example,
frustrated typing on a laptop keyboard or nervous leg shaking.
Specifically, if one student is studying at the table in row
With this, Ashley wants to find an empty table where she can hear as few other students as possible. Compute the minimum number of students that Ashley can hear if she selects her table optimally.
Input
The first line of input has four integers
Each of the next
Output
Output a single integer, which is the minimum number of students that Ashley can hear if she selects her table optimally.
Sample Input 1 | Sample Output 1 |
---|---|
3 2 1 3 1 1 2 2 3 1 |
2 |