CF1136D Nastya Is Buying Lunch

Description

At the big break Nastya came to the school dining room. There are $ n $ pupils in the school, numbered from $ 1 $ to $ n $ . Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e. Nastya took the last place in the queue. Of course, it's a little bit sad for Nastya, but she is not going to despond because some pupils in the queue can agree to change places with some other pupils. Formally, there are some pairs $ u $ , $ v $ such that if the pupil with number $ u $ stands directly in front of the pupil with number $ v $ , Nastya can ask them and they will change places. Nastya asks you to find the maximal number of places in queue she can move forward.

Input Format

N/A

Output Format

N/A

Explanation/Hint

In the first example Nastya can just change places with the first pupil in the queue. Optimal sequence of changes in the second example is - change places for pupils with numbers $ 1 $ and $ 3 $ . - change places for pupils with numbers $ 3 $ and $ 2 $ . - change places for pupils with numbers $ 1 $ and $ 2 $ . The queue looks like $ [3, 1, 2] $ , then $ [1, 3, 2] $ , then $ [1, 2, 3] $ , and finally $ [2, 1, 3] $ after these operations.