Problem: You are given an array consisting of integers. Each is one of the six following numbers: .
Your task is to remove the minimum number of elements to make this array good.
An array of length is called good if is divisible by and it is possible to split it into subsequences .
Examples of good arrays:
- (the whole array is a required sequence);
- (the first sequence is formed from first, second, fourth, fifth, seventh and tenth elements and the second one is formed from remaining elements);
- (the empty array is good).
Examples of bad arrays:
- (the order of elements should be exactly );
- (the length of the array is not divisible by );
- (the first sequence can be formed from first six elements but the remaining array cannot form the required sequence).
Input Format: The first line of the input contains one integer () — the number of elements in .
The second line of the input contains integers (each is one of the following numbers: ), where is the -th element of .
Output Format: Print one integer — the minimum number of elements you have to remove to obtain a good array.