13913 - Free Bear and Fruit Explorer Dogs   

Description

"One, two 福利,one, two 福利,happy~every day~" Haven't you ever heard of "Free Bear"? If not, don't worry. Free Bear, 福利熊,is the mascot of PX Mart 全聯福利中心。Once upon its first appearence in 2017, it went viral on Internet.

However, this problem is not mainly based on Free Bear. Three years later, Free Bear had got some friends 水果探險隊 (sorry for that I failed to find their official English name; let's call them Fruit Explorer Dogs, though) consisting of 蘋狗 (Bingo, namely Apple Dog), 香蕉狗 (Jungle, namely Banana Dog) and 奇異狗 (Kiwiko, namely Kiwi Dog) initially in 2020.

(I didn't expect that they even have a family tree diagram; maybe somebody could derive another problem...)
Last year (2022), Fruit Explorer Dogs welcomed the two brand new members: 芭樂狗 (Balego, namely Guava Dog) and 旺來狗 (Wanlaigo, namely Pineapple Dog).

It's known that PX Mart seems to never have enough number of clerks for its customers to checkout and one could often hears "We need backup(請支援收銀)". As a consequence, the first and the foremost tasks for Fruit Explorer Dogs is to back up the cashiers.

Since PX Mart has plenty of stores all over Taiwan, it requires quite a few number of fruit dogs. So suppose that PX Mart recruits far more fruit dogs. Note that some fruit dogs might belong to the same fruit, and PX Mart marks each type of fruit an unique ID.

Furthermore, it is difficult for a single fruit dog to handle the cashier. Therefore, they tend to team up. More formally, any fruit dogs with consecutive fruit ID could team up. For instance, if apple, banana, kiwi, guava and pineapple have ID 0, 1, 2, 8 and 9, respectively, then Bingo, Jungle and Kiwiko could form a team, whilst Balego and Wanlaigo could make another team.

You're the staff director of PX Mart and you'd like to determine the lower bound (minimum number) of teams Fruit Explorer Dogs could build. Write a program to resolve the bound!!

Input

There would be an integer \(n\) in the first line, indicating the number of members of Fruit Explorer Dogs that PX Mart currently recruits.

The next line would follow by an array \(a\) of \(n\) integers, where \(a_i\) denotes the fruit ID of \(i^\text{th}\) fruit dog.

It's guaranteed that \(n<2\times10^5\land a_i<10^9\) and for half of the test cases there's no any two fruit dogs belong to the same kind of fruit (thus no team would be overlapped to any other).

Output

Please print out an integer representing the lower bound (minimum number) of teams Fruit Explorer Dogs could build.

Sample Input  Download

Sample Output  Download

Tags




Discuss