Choose but not both

2.8

13 votes
Algorithms, Depth First Search, Dynamic Programming, Graphs, Trees
Problem

The alone Y has another array  that . this time Y wants to choose some numbers from  to  that there is no  that both  and  is chosen.

What is the maximum amount of numbers that Y can choose?

Input

First line contains only , legnth of array.

Second line contains the array elements separated by space.

Output

The only line of output contains an integer, maximum amount of numbers that Y can choose.

Sample Input
3
3 1 3
Sample Output
1
Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

Y cannot choose  because .

Y cannot choose both  and  because  so Y can choose only one number (either  or ).

Editor Image

?