Problem:
Score : 200 points

Problem Statement

You have written N problems to hold programming contests.
The i-th problem will have a score of P_i points if used in a contest.

With these problems, you would like to hold as many contests as possible under the following condition:

A contest has three problems. The first problem has a score not greater than A points, the second has a score between A + 1 and B points (inclusive), and the third has a score not less than B + 1 points.

The same problem should not be used in multiple contests.
At most how many contests can be held?

Constraints

3 \leq N \leq 100

1 \leq P_i \leq 20 (1 \leq i \leq N)

1 \leq A < B < 20

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A B
P_1 P_2 ... P_N

Output

Print the answer.

Sample Input 1

7
5 15
1 10 16 2 7 20 12

Sample Output 1

2

Two contests can be held by putting the first, second, third problems and the fourth, fifth, sixth problems together.

Sample Input 2

8
3 8
5 5 5 10 10 10 15 20

Sample Output 2

0

No contest can be held, because there is no problem with a score of A = 3 or less.

Sample Input 3

3
5 6
5 6 10

Sample Output 3

1

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

#include <bits/stdc++.h>
#define ll long long
#define rw freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (ll i=a;i<=b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define mod 998244353
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N=100000+5;
int arr[105]= {},vis[105]= {};
int main()
{
#ifdef ONLINE_JUDGE
    FAST;
#endif
    int n,a,b,cnt=0;
    cin>>n>>a>>b;
    lp(i,1,n)
    cin>>arr[i];
    lp(i,1,n)
    {
        if (vis[i])
            continue;
        lp(j,1,n)
        {
            if (vis[j]||j==i)
                continue;
            lp(k,1,n)
            {
                if (vis[k]||k==i||j==k)
                    continue;
                //i j k
                if (arr[i]<=a&&arr[j]>=a+1&&arr[j]<=b&&arr[k]>=b+1)
                {
                    vis[i]=vis[j]=vis[k]=true;
                    cnt++;
                    continue;
                }
                //j i k
                if (arr[j]<=a&&arr[i]>=a+1&&arr[i]<=b&&arr[k]>=b+1)
                {
                    vis[i]=vis[j]=vis[k]=true;
                    cnt++;
                    continue;
                }
                //k j i
                if (arr[k]<=a&&arr[j]>=a+1&&arr[j]<=b&&arr[i]>=b+1)
                {
                    vis[i]=vis[j]=vis[k]=true;
                    cnt++;
                    continue;
                }
                //j k i
                if (arr[j]<=a&&arr[k]>=a+1&&arr[k]<=b&&arr[i]>=b+1)
                {
                    vis[i]=vis[j]=vis[k]=true;
                    cnt++;
                    continue;
                }
                //k i j
                if (arr[k]<=a&&arr[i]>=a+1&&arr[i]<=b&&arr[j]>=b+1)
                {
                    vis[i]=vis[j]=vis[k]=true;
                    cnt++;
                    continue;
                }
                //i k j
                if (arr[i]<=a&&arr[k]>=a+1&&arr[k]<=b&&arr[j]>=b+1)
                {
                    vis[i]=vis[j]=vis[k]=true;
                    cnt++;
                    continue;
                }

            }
        }
    }
    cout<<cnt<<"\n";
    return 0;
}