Peter runs boarding at the Byteland airport, and his job is to make boarding faster. Planes in Byteland have s rows, numbered 1 through s starting at the front. Every row has six seats, labeled A to F.
The n passengers stand in one queue and board the plane one at a time. If passenger i sits in row ri, that passenger's boarding difficulty is the number of passengers who boarded earlier and sit in rows 1 through ri−1. The total boarding difficulty is the sum of the difficulties of all n passengers. For example, take ten passengers whose seats in queue order are 6A, 4B, 2E, 5F, 2A, 3F, 1C, 10E, 8B, 5A. Their difficulties are 0, 0, 0, 2, 0, 2, 0, 7, 7, 5 and the total is 23.
To speed boarding up, Peter divides the plane into k zones. Every zone is a continuous range of rows. Boarding then runs in k phases. In each phase Peter calls one zone, and the passengers seated in that zone board in their original queue order. Peter also decides which zone each phase calls.
Take the queue above and split the plane into two zones, rows 5 to 10 and rows 1 to 4. The first phase seats 6A, 5F, 10E, 8B, 5A and the second phase seats 4B, 2E, 2A, 3F, 1C, in that order. The total boarding difficulty is 6.
Given the queue, find the division into k zones that minimizes the total boarding difficulty and report that minimum.
The first line contains three integers n, s, and k (1≤n≤1000, 1≤s≤1000, 1≤k≤50, k≤s).
The second line contains n integers r1,r2,…,rn (1≤ri≤s), where ri is the row of the i-th passenger in the queue.
At most 6 passengers sit in any single row.
Print the minimum possible total boarding difficulty.