Andy is travelling through the galaxy. His mission is to categorize the planets that he passes. There are types of planets. He passes by different planets. Each of these planets can be classified as one of these types. You would like to help Andy on his mission by programming a computer assistant for him. Whenever he passes a planet, he will tell the assistant the type of this planet. The assistant must then tell him how many previous planets are of this type. At the end of his journey, the assistant must also report the total different types of planets that he has passed by.
Line : and , separated by a single space.
Line to : , the type of the planet that he has passed, where is the line number.
Line to : , the number of previous planets that are of type , where is the line number.
Line : , the total number of different types of planets that Andy has passed.
Subtask 1 [10%]
Subtask 2 [10%]
Subtask 3 [80%]
No additional constraints.
5 4 1 4 4 3 4
0 0 1 0 2 3