WC '18 Finals J1 - Conditional Contracts

View as PDF

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 16M

Author:
Problem type
Woburn Challenge 2018-19 Finals Round - Junior Division

The cows and monkeys of Scarberia, their long-standing conflicts well behind them at last, have banded together to produce a historical drama documenting their past battles. With the Head Monkey as writer and producer, and the director's chair occupied by the cows' leader, Bo Vine, this will be a collaborative masterpiece to remember!

As part of his preparations, Bo Vine is considering what width of film to use, an important artistic decision. He doesn't want to limit himself to a single width, so he's decided that two copies of the movie will be shot, on two different film widths! Each film width (measured in mm) must be an integer between and , inclusive, and the two widths must be distinct.

There are acclaimed actors interested in the film, and the Head Monkey and Bo Vine would like to cast as many of them as possible. However, they only work under very specific conditions- the -th actor insists that they must be captured on film with a width of exactly mm . Each actor can be employed if their requirement is satisfied for at least one of the two copies of the movie.

If Bo Vine chooses a pair of distinct film widths optimally, what's the maximum number of different actors who can be employed?

In test cases worth % of the points, for each .

Input Specification

The first line of input consists of a single integer, .
lines follow, the -th of which consists of a single integer, , for .

Output Specification

Output a single integer, the maximum number of actors who can be employed.

Sample Input

4
50
70
51
70

Sample Output

3

Sample Explanation

One possibility is using mm film for the first copy of the movie and mm film for the second copy. This allows the first, second, and fourth actors to be employed. It's impossible for all actors to be employed at once.