Ice Cream Machines

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Arnar, being a true Icelander, loves ice cream and today is just the perfect weather to go grab some of this delicious treat. He heads out into the blizzard to his favourite ice cream store. When he arrives he is surprised to see an unusually short queue ahead of him; he is only the nnth person waiting to order!

Arnar knows this ice cream store well. They offer mm different flavours, and they have kk ice cream machines. However, each machine can only serve one flavour at a time, and machines need to be cleaned before they can be loaded with a different flavour. Since cleaning a machine takes some time and Arnar is in a hurry, he wonders if he can help the store operator determine the optimal machine to clean every time a new flavour is needed to serve a customer, in order to minimise the total number of times the machines need to be cleaned.

Fortunately, Iceland is a small place and Arnar knows every single person in the queue and the flavour of ice cream they want. The store strictly enforces a no-cutting policy, so they will serve customers in the order they arrived. Can you help Arnar figure out the minimum number of times the ice cream machines need to be cleaned to serve everyone in the queue, including himself?

Initially all the ice cream machines are empty and need to be cleaned before they are loaded with their first flavour. Once an ice cream machine has been loaded with a particular flavour, it can be used to serve any number of customers that want that particular flavour, until the machine is cleaned and loaded with a different flavour. A machine that is not used at all does not need to be cleaned.

입력

The input consists of:

  • One line with three integers nn, mm, and kk, the number of customers waiting in the queue, the number of available flavours, and the number of ice cream machines.
  • nn lines, the iith of which contains an integer c_ic\_i, where 1c_im1 \leq c\_i \leq m, the flavour that the iith customer in the queue wants.

출력

Output the minimum total number of times the ice cream machines need to be cleaned in order to serve all nn customers.