NOI Contest Archive

Archive / 2021 / December 2021

Dulaj’s Dilemma

Medium · National Olympiad in Informatics Sri Lanka - December 2021

Dulaj is working as the coordinator of NOI Monthly Contests and he is responsible for choosing the problem-setters. Since everyone is busy these days, he decides to pair the candidates up to speed things up, and also he makes sure that every team has an equal total skill level to make it fair. This aside, he also wants to make the maximum number of teams possible because he was busy watching Squid Game and now the competition is only days away, so he needs all the help he can get. Due to his load of work, he assigns this task to you. Eager to impress him, you don’t hesitate and agree.

There are N number of problem-setters and each problem-setter is assigned with an integer that represents their problem-setting abilities. You are tasked with finding the maximum number of teams, that can be formed such that every team has the same total skill level. The total skill level of a team is the sum of skill levels of both team members.

Input Format

Output Format

Constraints

Sample Input 0

4
2
1 2
5
1 1 1 1 1
6
1 2 3 4 5 6
4
3 4 3 3

Sample Output 0

1
2
3
1