#C13421. Maximum Teams Formation

    ID: 42958 Type: Default 1000ms 256MiB

Maximum Teams Formation

Maximum Teams Formation

You are given n groups of students. Each group has a certain number of students. Your task is to determine the maximum number of teams of 4 students that can be formed such that each team is composed from the available groups.

A team can only be formed if there are at least 4 groups with a non-zero number of students. If there are fewer than 4 non-empty groups, then no team can be formed.

If there are at least 4 non-empty groups, the answer is computed as \( \lfloor \frac{\text{total number of students}}{4} \rfloor \), where \( \lfloor x \rfloor \) denotes the floor of x.

inputFormat

The first line contains an integer n (\( n \geq 1\)) representing the number of groups.

The second line contains n space-separated integers, where each integer represents the number of students in a group.

outputFormat

Output a single integer representing the maximum number of teams of 4 students that can be formed, following the rules described above.

## sample
4
1 1 1 1
1

</p>