JOIN

 Problem Statement

Problem Statement for Chopsticks

### Problem Statement

Cat Carol wants to invite some of her friends to a lunch at her house. Carol has some chopsticks of possibly different lengths. Each of the invited guests must receive two chopsticks. Additionally, the two chopsticks given to each guest must have exactly the same length.

You are given a int[] length. Each element of length is the length of one of Carol's chopsticks. Compute and return the maximum number of friends Carol may invite.

### Definition

 Class: Chopsticks Method: getmax Parameters: int[] Returns: int Method signature: int getmax(int[] length) (be sure your method is public)

### Constraints

-length will contain between 1 and 50 elements, inclusive.
-Each element of length will be between 1 and 100, inclusive.

### Examples

0)

 `{5,5}`
`Returns: 1`
 Two chopsticks have the same length. Carol can invite one friend.
1)

 `{1,2,3,2,1,2,3,2,1}`
`Returns: 4`
 Carol can make one pair of chopsticks of length 1, two pairs of chopsticks of length 2, and one pair of chopsticks of length 3. She can invite four guests in total.
2)

 `{1}`
`Returns: 0`
 Carol has only one chopstick. Carol can't invite anybody.
3)

 `{1,2,3,4,5,6,7,8,9}`
`Returns: 0`
 No two chopsticks have the same length. Carol can't invite anybody.
4)

 ```{35,35,35,50,16,30,10,10,35,50,16,16,16,30,50,30,16,35,50,30,10,50,50,16,16, 10,35,50,50,50,16,35,35,30,35,10,50,10,50,50,16,30,35,10,10,30,10,10,16,35}```
`Returns: 24`

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.

This problem was used for:
Single Round Match 570 Round 1 - Division II, Level One