Problem:
Score : 100 points

Problem Statement

There are N students in a school.

We will divide these students into some groups, and in each group they will discuss some themes.

You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible.

Divide the students so that the number of groups consisting of three or more students is maximized.

Constraints

1 \leq N \leq 1000

All input values are integers.

Input

Input is given from Standard Input in the following format:

N

Output

If you can form at most x groups consisting of three or more students, print x.

Sample Input 1

8

Sample Output 1

2

For example, you can form a group of three students and another of five students.

Sample Input 2

2

Sample Output 2

0

Sometimes you cannot form any group consisting of three or more students, regardless of how you divide the students.

Sample Input 3

9

Sample Output 3

3

Solution in C (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <stdio.h>
#include <stdlib.h>


int main (void){
        int N,top[5];
        long long int ans=0;
        char name[11];
        scanf("%d",&N);
        for (int i = 0; i < 5; i++) {
                top[i]=0;
        }
        for (int i = 0; i < N; i++) {
                scanf("%s",name);
                if(name[0]=='M') {
                        top[0]++;
                }
                if(name[0]=='A') {
                        top[1]++;
                }
                if(name[0]=='R') {
                        top[2]++;
                }
                if(name[0]=='C') {
                        top[3]++;
                }
                if(name[0]=='H') {
                        top[4]++;
                }
        }
        ans=top[0]*top[1]*top[2]+top[0]*top[1]*top[3]
             +top[0]*top[1]*top[4]+top[0]*top[2]*top[3]
             +top[0]*top[2]*top[4]+top[0]*top[3]*top[4]
             +top[1]*top[2]*top[3]+top[1]*top[2]*top[4]
             +top[1]*top[3]*top[4]+top[2]*top[3]*top[4];
        printf("%lld",ans);
        return 0;
}