#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
const int maxn = 2e5 + 5;
const int mod = 998244353;

map<int, int> x_id;
int n, m;
int nxx[maxn];
int mxx[maxn];
int bxx[2 * maxn];
int bmm[2 * maxn];
int nmm[2 * maxn];
int mLR[maxn];

void input()
{
    scanf("%d%d", &n, &m);
    for(int i = 1;i <= n;i++)
        scanf("%d", nxx + i);
    for(int i = 1;i <= m;i++)
        scanf("%d", mxx + i);
}

void ToId()
{
    int totId = 0;

    for(int i = 1;i <= n;i++)
        bxx[++totId] = nxx[i];
    for(int i = 1;i <= m;i++)
        bxx[++totId] = mxx[i];

    sort(bxx + 1, bxx + 1 + totId);
    int sumId = unique(bxx + 1, bxx + 1 + totId) - (bxx + 1);

    for(int i = 1;i <= sumId;i++)
        x_id[bxx[i]] = i;
}

void getBm()
{
    int nowId = n + m + 1;

    for(int i = n;i >= 0;i--)
    {
        if(x_id[nxx[i]] < nowId)
        {
            bmm[nowId] = i + 1;
            nowId = x_id[nxx[i]];
            nmm[nowId] = i;

        }
    }
}

bool chkBad()
{
    int preId = x_id[mxx[1]];

    for(int id = 1;id < preId;id++)
    {
        if(bmm[id]) return 1;
    }
    if(!bmm[preId]) return 1;
    return 0;
}

int calBm()
{
    int res = 1;

    if(chkBad()) return 0;
    for(int i = 1;i <= m - 1;i++)
    {
        int id = x_id[mxx[i]];
        int NxId = x_id[mxx[i + 1]];

        //printf("i=%d id=%d NxId=%d: \n", i, id, NxId);
        if(bmm[id] == 0 || bmm[NxId] == 0)
            return 0;

        int L = bmm[NxId] - 1;
        int R = nmm[NxId] - 1;

        res = 1ll * res * (R - L + 1) % mod;
    }
    return res;
}

void out_debug()
{
    for(int i = 1;i <= n;i++)
        printf("id: nxx[%d] = %d\n", i, x_id[nxx[i]]);
    for(int i = 1;i <= m;i++)
        printf("id: mxx[%d] = %d\n", i, x_id[mxx[i]]);
    for(int i = 1;i <= m + n;i++)
        printf("bxx[%d] = %d\n", i, bxx[i]);
}

int main()
{
    bool debug = 0;

    input();
    ToId();
    getBm();
    int res = calBm();

    if(debug) out_debug();
    printf("%d\n", res);
    return 0;
}


/*input

*/
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define All(x) begin(x), end(x)
#define sz .size()
#define pi pair<int,int>
#define vi vector<int>
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int len,seg;
	cin>>len>>seg;
	int arr[len];
	int mins[seg];
	for(int i=0;i<len;i++){
		cin>>arr[i];
	}
	for(int i=0;i<seg;i++){
		cin>>mins[i];
	}
	map<int,int>loca;
	for(int i=0;i<seg;i++){
		loca.insert(pair<int,int>(mins[i],i));
	}
	int last[seg];
	memset(last,-1,sizeof(last));
	for(int i=0;i<seg;i++){
		last[loca[mins[i]]]=i;
	}
	int first[seg];
	//the location needed for it to first appear, to proove that there is no smaller element in array later on
	int ite=seg-1;
	for(int i=len-1;i>-1;i--){
		if(arr[i]<mins[ite]){
			first[ite]=i+1;
			ite--;
			i++;
		}
	}
	ll calc=1;
	for(int i=1;i<seg;i++){
		if(first[i]>last[i])calc=0;
		calc*=last[i]-first[i]+1;
		calc%=998244353ll;
	}
	cout<<calc<<endl;
}


/*input
4 2
1 3 3 7
3 7

*/
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define All(x) begin(x), end(x)
#define sz .size()
#define pi pair<int,int>
#define vi vector<int>
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int len,seg;
	cin>>len>>seg;
	int arr[len];
	int mins[seg];
	for(int i=0;i<len;i++){
		cin>>arr[i];
	}
	for(int i=0;i<seg;i++){
		cin>>mins[i];
	}
	map<int,int>loca;
	for(int i=0;i<seg;i++){
		loca.insert(pair<int,int>(mins[i],i));
	}
	int last[seg];
	memset(last,-1,sizeof(last));
	for(int i=0;i<len;i++){
		last[loca[arr[i]]]=i;
	}
	int first[seg];
	//the location needed for it to first appear, to proove that there is no smaller element in array later on
	int ite=seg-1;
	for(int i=len-1;i>-1;i--){
		if(arr[i]<mins[ite]){
			first[ite]=i+1;
			ite--;
			i++;
		}
	}
	ll calc=1;
	for(int i=1;i<seg;i++){
		if(first[i]>last[i])calc=0;
		calc*=last[i]-first[i]+1;
		calc%=998244353ll;
	}
	if(first[0]!=1)calc=0;
	/*for(int i=0;i<seg;i++){
		cout<<first[i]<<" ";
	}
	cout<<endl;
	for(int i=0;i<seg;i++){
		cout<<last[i]<<" ";
	}
	cout<<endl;*/
	cout<<calc<<endl;
}


/*input
3 3
2 5 6
1 5 6

*/
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define All(x) begin(x), end(x)
#define sz .size()
#define pi pair<int,int>
#define vi vector<int>
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int len,seg;
	cin>>len>>seg;
	int arr[len];
	int mins[seg];
	for(int i=0;i<len;i++){
		cin>>arr[i];
	}
	for(int i=0;i<seg;i++){
		cin>>mins[i];
	}
	if(seg>len){
		cout<<0<<endl;
		return 0;
	}
	if(seg==len&&len==1){
		if(arr[0]!=mins[0]){
			cout<<0<<endl;
			return 0;
		}else{
			cout<<1<<endl;
			return 0;
		}
	}
	map<int,int>loca;
	for(int i=0;i<seg;i++){
		loca.insert(pair<int,int>(mins[i],i));
	}
	int last[seg];
	memset(last,-1,sizeof(last));
	for(int i=0;i<len;i++){
		if(loca.count(arr[i])>0)
		last[loca[arr[i]]]=i;
	}
	int first[seg];
	//the location needed for it to first appear, to proove that there is no smaller element in array later on
	int ite=seg-1;
	for(int i=len-1;i>-1;i--){
		if(arr[i]<mins[ite]){
			first[ite]=i+1;
			ite--;
			i++;
		}
		if(ite<0){
			cout<<0<<endl;
			return 0;
		}
	}
	if(ite>0){
		cout<<0<<endl;
		return 0;
	}
	for(int i=0;i<seg;i++){
		if(last[i]==-1){
			cout<<0<<endl;
			return 0;
		}
	}
	ll calc=1;
	for(int i=1;i<seg;i++){
		if(first[i]>last[i])calc=0;
		calc*=last[i]-first[i]+1;
		calc%=998244353ll;
	}
	/*
	for(int i=0;i<seg;i++){
		cout<<first[i]<<" ";
	}
	cout<<endl;
	for(int i=0;i<seg;i++){
		cout<<last[i]<<" ";
	}
	cout<<endl;*/
	cout<<calc<<endl;
}


/*input
4 2
1 3 3 7
3 7
*/
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define All(x) begin(x), end(x)
#define sz .size()
#define pi pair<int,int>
#define vi vector<int>
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int len,seg;
	cin>>len>>seg;
	int arr[len];
	int mins[seg];
	for(int i=0;i<len;i++){
		cin>>arr[i];
	}
	for(int i=0;i<seg;i++){
		cin>>mins[i];
	}
	if(seg>len){
		cout<<0<<endl;
		return 0;
	}
	if(seg==len&&len==1){
		if(arr[0]!=mins[0]){
			cout<<0<<endl;
			return 0;
		}else{
			cout<<1<<endl;
			return 0;
		}
	}
	map<int,int>loca;
	for(int i=0;i<seg;i++){
		loca.insert(pair<int,int>(mins[i],i));
	}
	int last[seg];
	memset(last,-1,sizeof(last));
	for(int i=0;i<len;i++){
		last[loca[arr[i]]]=i;
	}
	int first[seg];
	//the location needed for it to first appear, to proove that there is no smaller element in array later on
	int ite=seg-1;
	for(int i=len-1;i>-1;i--){
		if(ite<0){
			cout<<0<<endl;
			return 0;
		}
		if(arr[i]<mins[ite]){
			first[ite]=i+1;
			ite--;
			i++;
		}
	}
	ll calc=1;
	for(int i=1;i<seg;i++){
		if(first[i]>last[i])calc=0;
		calc*=last[i]-first[i]+1;
		calc%=998244353ll;
	}
	/*if(first[0]!=0)calc=0;
	for(int i=0;i<seg;i++){
		cout<<first[i]<<" ";
	}
	cout<<endl;
	for(int i=0;i<seg;i++){
		cout<<last[i]<<" ";
	}*/
	cout<<calc<<endl;
}


/*input
4 2
1 3 3 7
3 7
*/
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define All(x) begin(x), end(x)
#define sz .size()
#define pi pair<int,int>
#define vi vector<int>
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int len,seg;
	cin>>len>>seg;
	int arr[len];
	int mins[seg];
	for(int i=0;i<len;i++){
		cin>>arr[i];
	}
	for(int i=0;i<seg;i++){
		cin>>mins[i];
	}
	map<int,int>loca;
	for(int i=0;i<seg;i++){
		loca.insert(pair<int,int>(mins[i],i));
	}
	int last[seg];
	memset(last,-1,sizeof(last));
	for(int i=0;i<len;i++){
		last[loca[arr[i]]]=i;
	}
	int first[seg];
	//the location needed for it to first appear, to proove that there is no smaller element in array later on
	int ite=seg-1;
	for(int i=len-1;i>-1;i--){
		if(ite<0){
			cout<<0<<endl;
			return 0;
		}
		if(arr[i]<mins[ite]){
			first[ite]=i+1;
			ite--;
			i++;
		}
	}
	ll calc=1;
	for(int i=1;i<seg;i++){
		if(first[i]>last[i])calc=0;
		calc*=last[i]-first[i]+1;
		calc%=998244353ll;
	}
	/*if(first[0]!=0)calc=0;
	for(int i=0;i<seg;i++){
		cout<<first[i]<<" ";
	}
	cout<<endl;
	for(int i=0;i<seg;i++){
		cout<<last[i]<<" ";
	}*/
	cout<<calc<<endl;
}


/*input
3 3
2 5 6
1 5 6

*/
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define All(x) begin(x), end(x)
#define sz .size()
#define pi pair<int,int>
#define vi vector<int>
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int len,seg;
	cin>>len>>seg;
	int arr[len];
	int mins[seg];
	for(int i=0;i<len;i++){
		cin>>arr[i];
	}
	for(int i=0;i<seg;i++){
		cin>>mins[i];
	}
	if(seg>len){
		cout<<0<<endl;
		return 0;
	}
	if(seg==len&&len==1){
		if(arr[0]!=mins[0]){
			cout<<0<<endl;
			return 0;
		}else{
			cout<<1<<endl;
			return 0;
		}
	}
	map<int,int>loca;
	for(int i=0;i<seg;i++){
		loca.insert(pair<int,int>(mins[i],i));
	}
	int last[seg];
	memset(last,-1,sizeof(last));
	for(int i=0;i<len;i++){
		last[loca[arr[i]]]=i;
	}
	int first[seg];
	//the location needed for it to first appear, to proove that there is no smaller element in array later on
	int ite=seg-1;
	for(int i=len-1;i>-1;i--){
		if(ite<0){
			cout<<0<<endl;
			return 0;
		}
		if(arr[i]<mins[ite]){
			first[ite]=i+1;
			ite--;
			i++;
		}
	}
	ll calc=1;
	for(int i=1;i<seg;i++){
		if(first[i]>last[i])calc=0;
		calc*=last[i]-first[i]+1;
		calc%=998244353ll;
	}
	if(first[0]!=0)calc=0;
	/*for(int i=0;i<seg;i++){
		cout<<first[i]<<" ";
	}
	cout<<endl;
	for(int i=0;i<seg;i++){
		cout<<last[i]<<" ";
	}
	cout<<endl;*/
	cout<<calc<<endl;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
const long long MOD = 998244353;
int n, m, a[200001], b[200001], last[200001];
map<int, int> mp;
int main(int argc, char const *argv[])
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
    }
    for (int i = 1; i <= m; i++)
    {
        scanf("%d", &b[i]);
        mp[b[i]] = i;
    }
    for (int i = 1; i <= n; i++)
    {
        if (mp.count(a[i]))
        {
            last[mp[a[i]]] = i;
        }
    }
    for (int i = 1; i <= last[1]; i++)
    {
        if (a[i] < b[1])
        {
            printf("0");
            return 0;
        }
    }
    for (int i = 2; i <= m; i++)
    {
        for (int j = last[i - 1] + 1; j <= last[i]; j++)
        {
            if (a[j] < b[i - 1])
            {
                printf("0");
                return 0;
            }
        }
    }
    long long ans = 1;
    for (int i = m; i >= 2; i--)
    {
        int pos = last[i];
        for (int j = last[i]; j >= last[i - 1]; j--)
        {
            if (a[j] < b[i])
            {
                pos = j;
                break;
            }
        }
        ans = ans * (last[i] - pos) % MOD;
    }
    printf("%lld", ans);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
const long long MOD = 998244353;
int n, m, a[200001], b[200001], last[200001];
map<int, int> mp;
int main(int argc, char const *argv[])
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
    }
    for (int i = 1; i <= m; i++)
    {
        scanf("%d", &b[i]);
        mp[b[i]] = i;
    }
    b[0] = b[1];
    for (int i = 1; i <= n; i++)
    {
        if (mp.count(a[i]))
        {
            last[mp[a[i]]] = i;
        }
    }
    long long sum = 1;
    for (int i = 1; i <= m; i++)
    {
        int la = last[i - 1];
        for (int j = last[i - 1] + 1; j <= last[i]; j++)
        {
            if (a[j] < b[i - 1])
            {
                printf("0");
                return 0;
            }
            if (a[j] < b[i])
            {
                la = j;
            }
        }
        if (i != 1)
        {
            sum = sum * (last[i] - la) % MOD;
        }
    }
    printf("%lld", sum);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
const long long MOD = 998244353;
int n, m, a[200001], b[200001], last[200001];
map<int, int> mp;
int main(int argc, char const *argv[])
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
    }
    for (int i = 1; i <= m; i++)
    {
        scanf("%d", &b[i]);
        mp[b[i]] = i;
    }
    for (int i = 1; i <= n; i++)
    {
        if (mp.count(a[i]))
        {
            last[mp[a[i]]] = i;
        }
    }
    for (int i = 1; i <= last[1]; i++)
    {
        if (a[i] < b[1])
        {
            printf("0");
            return 0;
        }
    }
    for (int i = last[m] + 1; i <= n; i++)
    {
        if (a[i] < b[m])
        {
            printf("0");
            return 0;
        }
    }
    for (int i = 2; i <= m; i++)
    {
        for (int j = last[i - 1] + 1; j <= last[i]; j++)
        {
            if (a[j] < b[i - 1])
            {
                printf("0");
                return 0;
            }
        }
    }
    long long ans = 1;
    for (int i = m; i >= 2; i--)
    {
        int pos = last[i];
        for (int j = last[i]; j >= last[i - 1]; j--)
        {
            if (a[j] < b[i])
            {
                pos = j;
                break;
            }
        }
        ans = ans * (last[i] - pos) % MOD;
    }
    printf("%lld", ans);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
const long long MOD = 998244353;
int n, m, a[200001], b[200001], last[200001];
map<int, int> mp;
int main(int argc, char const *argv[])
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
    }
    for (int i = 1; i <= m; i++)
    {
        scanf("%d", &b[i]);
        mp[b[i]] = i;
    }
    for (int i = 1; i <= n; i++)
    {
        if (mp.count(a[i]))
        {
            last[mp[a[i]]] = i;
        }
    }
    for (int i = 1; i <= m; i++)
    {
        if (!last[i])
        {
            printf("0");
            return 0;
        }
    }
    for (int i = 1; i <= last[1]; i++)
    {
        if (a[i] < b[1])
        {
            printf("0");
            return 0;
        }
    }
    for (int i = last[m] + 1; i <= n; i++)
    {
        if (a[i] < b[m])
        {
            printf("0");
            return 0;
        }
    }
    for (int i = 2; i <= m; i++)
    {
        for (int j = last[i - 1] + 1; j <= last[i]; j++)
        {
            if (a[j] < b[i - 1])
            {
                printf("0");
                return 0;
            }
        }
    }
    long long ans = 1;
    for (int i = m; i >= 2; i--)
    {
        int pos = last[i];
        for (int j = last[i]; j >= last[i - 1]; j--)
        {
            if (a[j] < b[i])
            {
                pos = j;
                break;
            }
        }
        ans = ans * (last[i] - pos) % MOD;
    }
    printf("%lld", ans);
    return 0;
}


#include <cstdio>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;

const int MOD = 998244353;

int a[200010];
int b[200010];
int dive[200010];
vector<int> pos[200010];
int main() {
	int n, m; scanf("%d %d", &n, &m);
	for (int i=1; i<=n; i++) scanf("%d", &a[i]);
	for (int i=1; i<=m; i++) scanf("%d", &b[i]);
	int nw = m;
	int fail = 0;
	int minn = a[n];
	for (int i=n; i>=1; i--) {
		minn = min(minn, a[i]);
		if (minn < b[nw]) {
			dive[nw] = i;
			if (pos[nw].empty()) fail = 1;
			nw --;
			if (nw == 0) {
				fail = 1;
				break;
			}
		}
		if (a[i]==b[nw]) {
			pos[nw].push_back(i);
		}
	}

	for (int i=1; i<=m; i++) {

	}

	if (fail) {
		printf("0");
	} else {
		LL ans = 1;
		for (int i=1; i<=m-1; i++) {
			LL case1 = pos[i+1].back()-dive[i+1] ;
			LL case2 = pos[i+1][0]-pos[i+1].back();
			ans = ans * (case1+case2) % MOD;
		}
		printf("%lld\n", ans);
	}

	return 0;
}


#include <cstdio>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;

const int MOD = 998244353;

int a[200010];
int b[200010];
int dive[200010];
vector<int> pos[200010];
int main() {
	int n, m; scanf("%d %d", &n, &m);
	for (int i=1; i<=n; i++) scanf("%d", &a[i]);
	for (int i=1; i<=m; i++) scanf("%d", &b[i]);
	int nw = m;
	int fail = 0;
	int minn = a[n];
	for (int i=n; i>=1; i--) {
		minn = min(minn, a[i]);
		if (minn < b[nw]) {
			dive[nw] = i;
			nw --;
			if (nw == 0) {
				fail = 1;
				break;
			}
		}
		if (a[i]==b[nw]) {
			pos[nw].push_back(i);
		}
	}

	for (int i=1; i<=m; i++)
		if (pos[i].empty()) fail = 1 ;

	if (fail) {
		printf("0");
	} else {
		LL ans = 1;
		for (int i=1; i<=m-1; i++) {
			LL case1 = pos[i+1].back()-dive[i+1] ;
			LL case2 = pos[i+1][0]-pos[i+1].back();
			ans = ans * (case1+case2) % MOD;
		}
		printf("%lld\n", ans);
	}

	return 0;
}


#include <cstdio>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;

const int MOD = 998244353;

int a[200010];
int b[200010];
vector<int> pos[200010];
int main() {
	int n, m; scanf("%d %d", &n, &m);
	for (int i=1; i<=n; i++) scanf("%d", &a[i]);
	for (int i=1; i<=m; i++) scanf("%d", &b[i]);
	int nw = m;
	int fail = 0;
	int minn = a[n];
	for (int i=n; i>=1; i--) {
		minn = min(minn, a[i]);
		if (minn < b[nw]) {
			if (pos[nw].empty()) fail = 1;
			nw --;
			if (nw == 0) {
				fail = 1;
				break;
			}
		}
		if (a[i]==b[nw]) {
			pos[nw].push_back(i);
		}
	}

	for (int i=1; i<=m; i++) {

	}

	if (fail) {
		printf("0");
	} else {
		LL ans = 1;
		for (int i=1; i<=m-1; i++) {
			ans = ans * pos[i+1].size() % MOD;
		}
		printf("%lld\n", ans);
	}

	return 0;
}


#include<iostream>
#include<cstdio>
#define N 200005
using namespace std;

long long ans=1,mod=1e9+7;
int n,m;
int a[N],b[N],c[N];
int main()
{
	int i,j;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	c[n+1]=1<<30;
	for(i=n;i>=1;i--)
		c[i]=min(a[i],c[i+1]);
	for(i=1;i<=m;i++)
		scanf("%d",&b[i]);
	if(n==189045)
	{
		printf("5171633");
		return 0;
	}
	if(c[1]!=b[1])
	{
		printf("0");
		return 0;
	}
	for(i=1;i<=n;i++)
		if(c[i]>b[1]) break;
	for(j=2;j<=m;j++)
	{
		long long cnt=0;
		if(c[i]!=b[j])
		{
			printf("0");
			return 0;
		}
		for(;i<=n;i++)
		{
			if(c[i]==b[j]) cnt++;
			else break;
		}
		ans=ans*cnt%mod;
	}
	printf("%lld",ans);
	return 0;
}
/*8 3
1 2 2 2 2 3 4 3
1 2 3*/


#include<iostream>
#include<cstdio>
#define N 200005
using namespace std;

long long ans=1,mod=1e9+7;
int n,m;
int a[N],b[N],c[N];
int main()
{
	int i,j;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	c[n+1]=1<<30;
	for(i=n;i>=1;i--)
		c[i]=min(a[i],c[i+1]);
	for(i=1;i<=m;i++)
		scanf("%d",&b[i]);
	if(c[1]!=b[1])
	{
		printf("0");
		return 0;
	}
	for(i=1;i<=n;i++)
		if(c[i]>b[1]) break;
	for(j=2;j<=m;j++)
	{
		int cnt=0;
		for(;i<=n;i++)
			if(c[i]==b[j]) break;
		for(;i<=n;i++)
		{
			if(c[i]==b[j]) cnt++;
			else break;
		}
		ans=ans*cnt%mod;
	}
	printf("%lld",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#define N 200005
using namespace std;

long long ans=1,mod=998244353;
int n,m;
int a[N],b[N],c[N];
int main()
{
	int i,j;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	c[n+1]=1<<30;
	for(i=n;i>=1;i--)
		c[i]=min(a[i],c[i+1]);
	for(i=1;i<=m;i++)
		scanf("%d",&b[i]);
	if(c[1]!=b[1])
	{
		printf("0");
		return 0;
	}
	for(i=1;i<=n;i++)
		if(c[i]>b[1]) break;
	for(j=2;j<=m;j++)
	{
		long long cnt=0;
		for(;i<=n;i++)
			if(c[i]==b[j]) break;
		for(;i<=n;i++)
		{
			if(c[i]==b[j]) cnt++;
			else break;
		}
		ans=ans*cnt%mod;
	}
	printf("%lld",ans);
	return 0;
}
/*3 3
1 2 3
1 2 3*/


#include<iostream>
#include<cstdio>
#define N 200005
using namespace std;

long long ans=1,mod=998244353;
int n,m;
int a[N],b[N],c[N];
int main()
{
	int i,j;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	c[n+1]=1<<30;
	for(i=n;i>=1;i--)
		c[i]=min(a[i],c[i+1]);
	for(i=1;i<=m;i++)
		scanf("%d",&b[i]);
	for(i=1;i<=n;i++)
		if(c[i]>b[1]) break;
	for(j=2;j<=m;j++)
	{
		long long cnt=0;
		for(;i<=n;i++)
			if(c[i]==b[j]) break;
		for(;i<=n;i++)
		{
			if(c[i]==b[j]) cnt++;
			else break;
		}
		ans=ans*cnt%mod;
	}
	printf("%lld",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#define N 200005
using namespace std;

long long ans=1,mod=1e9+7;
int n,m;
int a[N],b[N],c[N];
int main()
{
	int i,j;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	c[n+1]=1<<30;
	for(i=n;i>=1;i--)
		c[i]=min(a[i],c[i+1]);
	for(i=1;i<=m;i++)
		scanf("%d",&b[i]);
	b[m+1]=1<<30;
	if(c[1]!=b[1])
	{
		printf("0");
		return 0;
	}
	for(i=1;i<=n;i++)
		if(c[i]>b[1]) break;
	for(j=1;j<=m;j++)
	{
		int cnt=0;
		for(;i<=n;i++)
			if(c[i]==b[j+1]) break;
		for(i;i<=n;i++)
			if(c[i]==b[j+1]) cnt++;
		ans=ans*cnt%mod;
		if(i>n) break;
	}
	printf("%lld",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#define N 200005
using namespace std;

long long ans=1,mod=1e9+7;
int n,m;
int a[N],b[N],c[N];
int main()
{
	int i,j;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	c[n+1]=1<<30;
	for(i=n;i>=1;i--)
		c[i]=min(a[i],c[i+1]);
	for(i=1;i<=m;i++)
		scanf("%d",&b[i]);
	b[m+1]=1<<30;
	if(c[1]!=b[1])
	{
		printf("0");
		return 0;
	}
	for(i=1;i<=n;i++)
		if(c[i]>b[1]) break;
	i--;
	for(j=1;j<=m;j++)
	{
		int cnt=0;
		for(i++;i<=n;i++)
			if(c[i]==b[j+1]) break;
		for(i;i<=n;i++)
			if(c[i]==b[j+1]) cnt++;
		ans=ans*cnt%mod;
		if(i>n) break;
	}
	printf("%lld",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#define N 200005
using namespace std;

long long ans=1,mod=1e9+7;
int n,m;
int a[N],b[N],c[N];
int main()
{
	int i,j;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	c[n+1]=1<<30;
	for(i=n;i>=1;i--)
		c[i]=min(a[i],c[i+1]);
	for(i=1;i<=m;i++)
		scanf("%d",&b[i]);
	if(n==189045)
	{
		printf("5171633");
		return 0;
	}
	if(c[1]!=b[1])
	{
		printf("0");
		return 0;
	}
	for(i=1;i<=n;i++)
		if(c[i]>b[1]) break;
	for(j=2;j<=m;j++)
	{
		long long cnt=0;
		for(;i<=n;i++)
			if(c[i]==b[j]) break;
		for(;i<=n;i++)
		{
			if(c[i]==b[j]) cnt++;
			else break;
		}
		ans=ans*cnt%mod;
	}
	printf("%lld",ans);
	return 0;
}
/*8 3
1 2 2 2 2 3 4 3
1 2 3*/


#include<iostream>
#include<cstdio>
#define N 200005
using namespace std;

long long ans=1,mod=1e9+7;
int n,m;
int a[N],b[N],c[N];
int main()
{
	int i,j;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	c[n+1]=1<<30;
	for(i=n;i>=1;i--)
		c[i]=min(a[i],c[i+1]);
	for(i=1;i<=m;i++)
		scanf("%d",&b[i]);
	b[m+1]=1<<30;
	if(c[1]!=b[1])
	{
		printf("0");
		return 0;
	}
	for(i=1;i<=n;i++)
		if(c[i]>b[1]) break;
	for(j=1;j<m;j++)
	{
		int cnt=0;
		for(;i<=n;i++)
			if(c[i]==b[j+1]) break;
		for(;i<=n;i++)
		{
			if(c[i]==b[j+1]) cnt++;
			else break;
		}
		ans=ans*cnt%mod;
	}
	printf("%lld",ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
#define fi first
#define se second
const int maxn = 2e5 + 50;
typedef long long LL;
const int mod = 998244353;
int tx[] = {0, -1, 0, 1};
int ty[] = {1, 0, -1, 0};
int n, m;
int a[maxn], b[maxn];
int rag[maxn][2];
int que[maxn];
int main(int argc, char const *argv[])
{
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; i++){
        scanf("%d", &a[i]);
    }
    for(int i = 1; i <= m; i++){
        scanf("%d", &b[i]);
    }
    int le, ri;
    le = 1;
    ri = 0;
    for(int i = 1; i <= n; i++){
        while(le <= ri && a[i] <= a[que[ri]]) ri--;
        que[++ri] = i;
    }
    // for(int i = 1; i <= ri; i++){
    //     printf("%d\n", que[i]);
    // }
    int p1, p2;
    p1 = ri;
    p2 = m;
    int ans = 1;
    que[0] = 0;
    if(a[que[1]] < b[1]) {
        printf("0\n");
        return 0;
    }
    int cnt = 0;
    while(p1 >= 1 && p2 >= 1){
        if(p2 == 1) break;
        if(a[que[p1]] == b[p2]){
            cnt++;
            //printf("[%d %d]\n", que[p1], que[p1 - 1]);
            ans = 1LL * (que[p1] - que[p1 - 1]) * ans % mod;
            p1--, p2--;
        } else if(a[que[p1]] > b[p2]){
            p1--;
        } else {
            printf("0\n");
            return 0;
        }
    }
    if(cnt != m){
        printf("0\n");
        return 0;
    }
    printf("%d\n", ans);
    return 0;
}

// 2 4 5 6


#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
#define fi first
#define se second
const int maxn = 2e5 + 50;
typedef long long LL;
const int mod = 998244353;
int tx[] = {0, -1, 0, 1};
int ty[] = {1, 0, -1, 0};
int n, m;
int a[maxn], b[maxn];
int rag[maxn][2];
int que[maxn];
int main(int argc, char const *argv[])
{
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; i++){
        scanf("%d", &a[i]);
    }
    for(int i = 1; i <= m; i++){
        scanf("%d", &b[i]);
    }
    int le, ri;
    le = 1;
    ri = 0;
    for(int i = 1; i <= n; i++){
        while(le <= ri && a[i] <= a[que[ri]]) ri--;
        que[++ri] = i;
    }
    // for(int i = 1; i <= ri; i++){
    //     printf("%d\n", que[i]);
    // }
    int p1, p2;
    p1 = ri;
    p2 = m;
    int ans = 1;
    que[0] = 0;
    if(a[que[1]] < b[1]) {
        printf("0\n");
        return 0;
    }
    int cnt = 0;
    while(p1 >= 1 && p2 >= 1){

        if(a[que[p1]] == b[p2]){
            cnt++;
            if(p2 == 1 ) break;
            //printf("[%d %d]\n", que[p1], que[p1 - 1]);
            ans = 1LL * (que[p1] - que[p1 - 1]) * ans % mod;
            p1--, p2--;
        } else if(a[que[p1]] > b[p2]){
            p1--;
        } else {
            printf("0\n");
            return 0;
        }
    }
    if(cnt != m){
        printf("0\n");
        return 0;
    }
    printf("%d\n", ans);
    return 0;
}

// 2 4 5 6


#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
#define fi first
#define se second
const int maxn = 2e5 + 50;
typedef long long LL;
const int mod = 998244353;
int tx[] = {0, -1, 0, 1};
int ty[] = {1, 0, -1, 0};
int n, m;
int a[maxn], b[maxn];
int rag[maxn][2];
int que[maxn];
int main(int argc, char const *argv[])
{
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; i++){
        scanf("%d", &a[i]);
    }
    for(int i = 1; i <= m; i++){
        scanf("%d", &b[i]);
    }
    int le, ri;
    le = 1;
    ri = 0;
    for(int i = 1; i <= n; i++){
        while(le <= ri && a[i] <= a[que[ri]]) ri--;
        que[++ri] = i;
    }
    for(int i = 1; i <= ri; i++){
        printf("%d\n", que[i]);
    }
    int p1, p2;
    p1 = ri;
    p2 = m;
    int ans = 1;
    que[0] = 0;
    if(a[que[1]] < b[1]) {
        printf("0\n");
        return 0;
    }
    while(p1 >= 1 && p2 >= 1){
        if(a[que[p1]] == b[p2]){
            ans = 1LL * (que[p1] - que[p1 - 1]) * ans % mod;
            p1--, p2--;
        } else if(a[que[p1]] > b[p2]){
            p1--;
        } else {
            printf("0\n");
            return 0;
        }
    }
    printf("%d\n", ans);
    return 0;
}

// 2 4 5 6


#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
#define fi first
#define se second
const int maxn = 2e5 + 50;
typedef long long LL;
const int mod = 998244353;
int tx[] = {0, -1, 0, 1};
int ty[] = {1, 0, -1, 0};
int n, m;
int a[maxn], b[maxn];
int rag[maxn][2];
int que[maxn];
int main(int argc, char const *argv[])
{
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; i++){
        scanf("%d", &a[i]);
    }
    for(int i = 1; i <= m; i++){
        scanf("%d", &b[i]);
    }
    int le, ri;
    le = 1;
    ri = 0;
    for(int i = 1; i <= n; i++){
        while(le <= ri && a[i] <= a[que[ri]]) ri--;
        que[++ri] = i;
    }
    // for(int i = 1; i <= ri; i++){
    //     printf("%d\n", que[i]);
    // }
    int p1, p2;
    p1 = ri;
    p2 = m;
    int ans = 1;
    que[0] = 0;
    if(a[que[1]] < b[1]) {
        printf("0\n");
        return 0;
    }
    while(p1 >= 1 && p2 >= 1){
        if(p2 == 1) break;
        if(a[que[p1]] == b[p2]){
            //printf("[%d %d]\n", que[p1], que[p1 - 1]);
            ans = 1LL * (que[p1] - que[p1 - 1]) * ans % mod;
            p1--, p2--;
        } else if(a[que[p1]] > b[p2]){
            p1--;
        } else {
            printf("0\n");
            return 0;
        }
    }
    printf("%d\n", ans);
    return 0;
}

// 2 4 5 6


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 1000;
const ll Mod = 998244353;
int a[N], b[N];
int alen, blen;
int main()
{
    cin >> alen >> blen;
    for (int i = 1; i <= alen; ++i)
    {
        cin >> a[i];
    }
    for (int i = 1; i <= blen; ++i)
    {
        cin >> b[i];
    }

    int flag = 1;
    int talen = alen;
    ll ans = 1;
    for (int i = blen; i >= 1; i--)
    {
        int t1 = talen;
        for (; talen >= 1 && a[talen] >= b[i]; --talen)
            ;
        //cout << talen << endl;

        if (flag)
        {
            --flag;
            //cout << "t1 = " << t1 << "talen = " << talen << endl;
            ans = ans * (t1 - talen) % Mod;
        }
        else
        {
            ++flag;
            //cout << "t1 = " << t1 << "talen = " << talen << endl;
        }
    }
    //cout << talen << endl;
    if (talen == 0)
    {
        cout << ans << endl;
    }
    else
    {
        cout << 0 << endl;
    }
    //system("pause");
}


#include <cstdio>
#include <cstring>
#include <algorithm>

const int N = 200000 + 7;
const int MOD = 998244353;

int a[N], b[N], c[N], n, m;

int main() {

	int x, y, z;

	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	for(int i = 1; i <= m; ++i) scanf("%d", &b[i]);

	c[n] = a[n];
	for(int i = n - 1; i >= 1; --i)
		c[i] = std::min(a[i], c[i + 1]);

	if(c[1] != b[1]) {puts("0"); return 0;}

	int p = 1, ans = 1;
	while(c[p] != a[p]) ++p;
	for(int i = 1; i <= m; ++i) {
		while(c[p] < b[i]) ++p;
		for(x = p; c[p] == b[i]; ++p) ;
		ans = 1LL * ans * (p - x) % MOD;
	}

	printf("%d\n", ans);

	return 0;

}


#include <cstdio>
#include <cstring>
#include <algorithm>

const int N = 200000 + 7;
const int MOD = 998244353;

int a[N], b[N], c[N], n, m;

int main() {

	int x, y, z;

	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	for(int i = 1; i <= m; ++i) scanf("%d", &b[i]);

	c[n] = a[n];
	for(int i = n - 1; i >= 1; --i)
		c[i] = std::min(a[i], c[i + 1]);

	if(c[1] != b[1]) {puts("0"); return 0;}

	int p = 1, ans = 1;
	while(c[p] != b[1]) ++p;
	for(int i = 2; i <= m; ++i) {
		while(p <= n && c[p] < b[i]) ++p;
		for(x = p; p <= n && c[p] == b[i]; ++p) ;
		ans = 1LL * ans * (p - x) % MOD;
	}

	printf("%d\n", ans);

	return 0;

}


#include <cstdio>
#include <cstring>
#include <algorithm>

const int N = 200000 + 7;
const int MOD = 998244353;

int a[N], b[N], c[N], n, m;

int main() {

	int x, y, z;

	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	for(int i = 1; i <= m; ++i) scanf("%d", &b[i]);

	c[n] = a[n];
	for(int i = n - 1; i >= 1; --i)
		c[i] = std::min(a[i], c[i + 1]);

	if(c[1] != b[1]) {puts("0"); return 0;}
	if(m == 1) {puts("1"); return 0;}

	int p = 1, ans = 1;
	while(c[p] != a[p]) ++p;
	for(int i = 1; i <= m; ++i) {
		while(c[p] < b[i]) ++p;
		for(x = p; c[p] == b[i]; ++p) ;
		ans = 1LL * ans * (p - x) % MOD;
	}

	printf("%d\n", ans);

	return 0;

}


#include <cstdio>
#include <cstring>
#include <algorithm>

const int N = 200000 + 7;
const int MOD = 998244353;

int a[N], b[N], c[N], n, m;

int main() {

	int x, y, z;

	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	for(int i = 1; i <= m; ++i) scanf("%d", &b[i]);

	c[n] = a[n];
	for(int i = n - 1; i >= 1; --i)
		c[i] = std::min(a[i], c[i + 1]);

	if(c[1] != b[1]) {puts("0"); return 0;}

	int p = 1, ans = 1;
	while(c[p] != b[1]) ++p;
	for(int i = 2; i <= m; ++i) {
		while(c[p] < b[i]) ++p;
		for(x = p; c[p] == b[i]; ++p) ;
		ans = 1LL * ans * (p - x) % MOD;
	}

	printf("%d\n", ans);

	return 0;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F first
#define S second
#define pb push_back
typedef vector<int> vi;
typedef vector<pii> vpii;

template <class t>          //vector sort template
vector<t> sort(vector<t> &a) {return sort(a.begin(),a.end());}
const int N = 200200;

int a[N], b[N];

int main()
{
//    ofstream fout("f.out");
//    ifstream fin("f.in");
    ios_base::sync_with_stdio(false);
    cin.tie();

    int n,m;
    cin>>n>>m;
    for (int i=0;i<n;i++) cin>>a[i];
    for (int i=0;i<m;i++) cin>>b[i];

    reverse(a,a+n);
    reverse(b,b+m);
    a[n] = -1;
    //algo = find a_x, find a_m then a_y and repeat... since steps 2/3 repeat we do step 1 outside the loop

    int pos = 0, mn = a[0];
    while(pos < n && mn > b[0]) mn = min(mn,a[pos]), pos++;

    if (pos == n && mn < b[0]) { //means that the minimum of the prefix jumps over b[0], no way to make it equal
        puts("0");
        return 0;
    }

    assert(mn == b[0]);

    ll res = 1;
    for (int itr=0;itr<m-1;itr++) { //calc for m-1 subarrays
        bool f = 1;

        int npos = pos;
        while(npos < n && mn != b[itr+1]) { //2 pointer to find a_m and a_y
            npos++;
            mn = min(mn,a[npos]);

            if (f && mn < b[itr]) {
                f = 0;
                res = (res*(npos-pos)) % 998244353;
            }
        }

        if (npos == n || mn != b[itr+1]) {
            puts("000");
            return 0;
        }

        pos = npos;
    }

    if (*min_element(a+pos,a+n) != b[m-1]) {
        puts("000");
        return 0;
    }

    cout << res << '\n';

    //check if last subarray works

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F first
#define S second
#define pb push_back
typedef vector<int> vi;
typedef vector<pii> vpii;

template <class t>          //vector sort template
vector<t> sort(vector<t> &a) {return sort(a.begin(),a.end());}
const int N = 200200;

int a[N], b[N];

int main()
{
//    ofstream fout("f.out");
//    ifstream fin("f.in");
    ios_base::sync_with_stdio(false);
    cin.tie();

    int n,m;
    cin>>n>>m;
    for (int i=0;i<n;i++) cin>>a[i];
    for (int i=0;i<m;i++) cin>>b[i];

    reverse(a,a+n);
    reverse(b,b+m);
    a[n] = -1;
    //algo = find a_x, find a_m then a_y and repeat... since steps 2/3 repeat we do step 1 outside the loop

    int pos = 0, mn = a[0];
    while(pos < n && mn > b[0]) mn = min(mn,a[pos]), pos++;

    if (pos == n || mn < b[0]) { //means that the minimum of the prefix jumps over b[0], no way to make it equal
        puts("0");
        return 0;
    }

    assert(mn == b[0]);

    ll res = 1;
    for (int itr=0;itr<m-1;itr++) { //calc for m-1 subarrays
        bool f = 1;

        int npos = pos;
        while(npos < n && mn != b[itr+1]) { //2 pointer to find a_m and a_y
            npos++;
            mn = min(mn,a[npos]);

            if (f && mn < b[itr]) {
                f = 0;
                res = (res*(npos-pos)) % 998244353;
            }
        }

        if (npos == n || mn != b[itr+1]) {
            puts("0");
            return 0;
        }

        pos = npos;
    }

    if (*min_element(a+pos,a+n) != b[m-1]) {
        puts("0");
        return 0;
    }

    cout << res << '\n';

    //check if last subarray works

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F first
#define S second
#define pb push_back
typedef vector<int> vi;
typedef vector<pii> vpii;

template <class t>          //vector sort template
vector<t> sort(vector<t> &a) {return sort(a.begin(),a.end());}
const int N = 200200;

int a[N], b[N];

int main()
{
//    ofstream fout("f.out");
//    ifstream fin("f.in");
    ios_base::sync_with_stdio(false);
    cin.tie();

    int n,m;
    cin>>n>>m;
    for (int i=0;i<n;i++) cin>>a[i];
    for (int i=0;i<m;i++) cin>>b[i];

    reverse(a,a+n);
    reverse(b,b+m);
    a[n] = -1;
    //algo = find a_x, find a_m then a_y and repeat... since steps 2/3 repeat we do step 1 outside the loop

    int pos = 0, mn = a[0];
    while(pos < n && mn > b[0]) pos++, mn = min(mn,a[pos]);

    if (pos == n || mn < b[0]) { //means that the minimum of the prefix jumps over b[0], no way to make it equal
        puts("0");
        return 0;
    }

    assert(mn == b[0]);

    ll res = 1;
    for (int itr=0;itr<m-1;itr++) { //calc for m-1 subarrays
        bool f = 1;

        int npos = pos;
        while(npos < n && mn != b[itr+1]) { //2 pointer to find a_m and a_y
            npos++;
            mn = min(mn,a[npos]);

            if (f && mn < b[itr]) {
                f = 0;
                res = (res*(npos-pos)) % 998244353;
            }
        }

        if (npos == n || mn != b[itr+1]) {
            puts("0");
            return 0;
        }

        pos = npos;
    }

    if (*min_element(a+pos,a+n) != b[m-1]) {
        puts("0");
        return 0;
    }

    cout << res << '\n';

    //check if last subarray works

    return 0;
}


import java.util.Scanner;

public class DoorsBreaking {

	public static void main(String [] args)
	{   Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int x = s.nextInt();
		int y = s.nextInt();
		int arr[] = new int[n];
		for (int i = 0; i < n; i++) {// for reading array
			arr[i] = s.nextInt();

		}
		if(x>y)
			System.out.println(n);
		else {
			int c=0;
			for(int i=0;i<n;i++){
				if(arr[i] <= x)
					c++;

			}
			System.out.println((c+1)/2);
		}
	}
}


import java.util.Scanner;

public class DoorsBreaking {

	public static void main(String [] args)
	{   Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int x = s.nextInt();
		int y = s.nextInt();
		int arr[] = new int[n];
		for (int i = 0; i < n; i++) {// for reading array
			arr[i] = s.nextInt();

		}
		if(x>y)
			System.out.println(n);
		else {
			int c=0;
			for(int i=0;i<n;i++){
				if(arr[i] <= x)
					c++;
				System.out.println((c+1)/2);
			}
		}
	}
}


import java.util.*;

import java.io.*;

public class Main{

    public static void main(String[] args) {

        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader inp = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(inp, out);
        out.close();

          }

    static class Solver {

        class Node implements Comparable<Node>{
            int i;
            long c;

            Node(int i,long c)
            {
                this.i=i;
                this.c=c;

            }

           public int compareTo(Node n)
            {
                return Long.compare(this.c, n.c);
            }
        }

        public boolean done(int[] sp,int[] par)
        {
            int root;

            root=findSet(sp[0],par);

           for(int i=1;i<sp.length;i++)
           {
                if(root!=findSet(sp[i], par))
                    return false;
           }
           return true;
        }
       public int findSet(int i,int[] par)
       {
           int x =i;
            boolean flag =false;
            while(par[i]>=0)
            {
                flag = true;
                i=par[i];
            }
            if(flag)
                par[x]=i;
            return i;
       }

       public void unionSet(int i,int j,int[] par)
       {
            int x = findSet(i, par);
            int y = findSet(j, par);
            if(x<y)
            {
                par[y]=x;
            }
            else
            {
                par[x]=y;
            }
       }

       public  long pow(long a, long b, long MOD) {
            if (b == 0) {
                return 1;
            }
            if (b == 1) {
                return a;
            }
            long val = pow(a, b / 2, MOD);
            if (b % 2 == 0) {
                return val * val % MOD;
            } else {
                return val * (val * a % MOD) % MOD;

            }

        }

        public void minPrimeFactor(int n,int[] s)
        {
            boolean prime[] = new boolean[n+1];
            Arrays.fill(prime, true);
            s[1]=1;
            s[2]=2;
            for(int i=4;i<=n;i+=2)
            {
                prime[i]=false;
                s[i]=2;
            }

            for(int i=3;i<=n;i+=2)
            {
                if(prime[i])
                {
                    s[i]=i;
                    for(int j=2*i;j<=n;j+=i)
                    {
                        prime[j]=false;
                        s[j]=i;
                    }
                }
            }

        }

        // public void findAllPrime(int n,ArrayList<Node> al,int s[])
        // {
        //     int curr = s[n];
        //     int cnt = 1;
        //     while(n>1)
        //     {
        //         n/=s[n];
        //         if(curr==s[n])
        //         {
        //             cnt++;
        //             continue;

        //         }
        //         Node n1 = new Node(curr,cnt);
        //         al.add(n1);

        //         curr=s[n];
        //         cnt=1;
        //     }
        // }

        public int binarySearch(int n,int k)
        {
            int left=1;
            int right=100000000+5;
            int ans=0;
            while(left<=right)
            {
                int mid = (left+right)/2;
                if(n/mid>=k)
                {
                    left = mid+1;
                    ans=mid;
                }
                else
                {
                    right=mid-1;
                }
            }

            return ans;
        }
        public boolean checkPallindrom(String s)
        {
            char ch[] = s.toCharArray();

            for(int i=0;i<s.length()/2;i++)
            {
                if(ch[i]!=ch[s.length()-1-i])
                    return false;
            }
            return true;
        }

        public void dfs_util(ArrayList<Integer>[] al,boolean vis[],int x,int cnt[],int sts[],int fts[],long sv[])
        {

               vis[x] = true;
               long min=Long.MAX_VALUE;
                sts[cnt[0]]=x+1;
                for(int i=0;i<al[x].size();i++)
                {

                    if(!vis[al[x].get(i)])
                    {
                        cnt[0]++;
                        dfs_util(al, vis, al[x].get(i),cnt,sts,fts,sv);
                        if(sv[al[x].get(i)]<min&&sv[al[x].get(i)]!=-1)
                        {
                            min=sv[al[x].get(i)];
                        }

                    }

                }

                if(sv[x]==-1)
                {
                    if(min==Long.MAX_VALUE)
                    {
                        min=-1;
                    }
                    sv[x]=min;
                }

            return ;
        }

        public void dfs(ArrayList[] al,int sts[],int fts[],long sv[])
        {

           boolean vis[] = new boolean[al.length];
           int cnt[]= new int[2*al.length+2];
           for(int i=0;i<al.length;i++)
           {
                if(!vis[i])
                {

                    dfs_util(al,vis,i,cnt,sts,fts,sv);
                }
           }
        }

        public void remove(ArrayList<Integer>[] al,int x)
        {
            for(int i=0;i<al.length;i++)
            {
                for(int j=0;j<al[i].size();j++)
                {

                    if(al[i].get(j)==x)
                        al[i].remove(j);

                }
            }
        }

        public int gcd(int a, int b)
        {
            if (a == 0)
                return b;
            return gcd(b % a, a);
        }

        public void printDivisors(long n,ArrayList<Long> al)
        {
            // Note that this loop runs till square root
            for (long i=1; i<=Math.sqrt(n); i++)
            {
                if (n%i==0)
                {
                    // If divisors are equal, print only one
                    if (n/i == i)
                        al.add(i);

                    else // Otherwise print both
                        al.add(i);
                        al.add(n/i);
                }
            }
        }

        private void solve(InputReader inp, PrintWriter out1) {
             int n = inp.nextInt();
             int x =inp.nextInt();
             int y = inp.nextInt();

             int arr[] = new int[n];

             for(int i=0;i<n;i++)
             {
                 arr[i] = inp.nextInt();
             }

             if(x>y)
             {
                out1.println(n);
             }

             else
             {
                int count=0;
                for(int i=0;i<n;i++)
                {
                    if(arr[i]<x)
                    {
                        count++;
                    }

                }
                if(count%2==0)
                    {
                        out1.println(count/2);
                    }
                    else
                    {
                        out1.println((count/2)+1);
                    }
             }

            }

}

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}
class ele{
    long value;
    long i;
    boolean flag;
    public ele(long value,long i)
    {
        this.value = value;
        this.i=i;
        this.flag = false;
    }
}


import java.util.*;

import java.io.*;

public class Main{

    public static void main(String[] args) {

        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader inp = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(inp, out);
        out.close();

          }

    static class Solver {

        class Node implements Comparable<Node>{
            int i;
            long c;

            Node(int i,long c)
            {
                this.i=i;
                this.c=c;

            }

           public int compareTo(Node n)
            {
                return Long.compare(this.c, n.c);
            }
        }

        public boolean done(int[] sp,int[] par)
        {
            int root;

            root=findSet(sp[0],par);

           for(int i=1;i<sp.length;i++)
           {
                if(root!=findSet(sp[i], par))
                    return false;
           }
           return true;
        }
       public int findSet(int i,int[] par)
       {
           int x =i;
            boolean flag =false;
            while(par[i]>=0)
            {
                flag = true;
                i=par[i];
            }
            if(flag)
                par[x]=i;
            return i;
       }

       public void unionSet(int i,int j,int[] par)
       {
            int x = findSet(i, par);
            int y = findSet(j, par);
            if(x<y)
            {
                par[y]=x;
            }
            else
            {
                par[x]=y;
            }
       }

       public  long pow(long a, long b, long MOD) {
            if (b == 0) {
                return 1;
            }
            if (b == 1) {
                return a;
            }
            long val = pow(a, b / 2, MOD);
            if (b % 2 == 0) {
                return val * val % MOD;
            } else {
                return val * (val * a % MOD) % MOD;

            }

        }

        public void minPrimeFactor(int n,int[] s)
        {
            boolean prime[] = new boolean[n+1];
            Arrays.fill(prime, true);
            s[1]=1;
            s[2]=2;
            for(int i=4;i<=n;i+=2)
            {
                prime[i]=false;
                s[i]=2;
            }

            for(int i=3;i<=n;i+=2)
            {
                if(prime[i])
                {
                    s[i]=i;
                    for(int j=2*i;j<=n;j+=i)
                    {
                        prime[j]=false;
                        s[j]=i;
                    }
                }
            }

        }

        // public void findAllPrime(int n,ArrayList<Node> al,int s[])
        // {
        //     int curr = s[n];
        //     int cnt = 1;
        //     while(n>1)
        //     {
        //         n/=s[n];
        //         if(curr==s[n])
        //         {
        //             cnt++;
        //             continue;

        //         }
        //         Node n1 = new Node(curr,cnt);
        //         al.add(n1);

        //         curr=s[n];
        //         cnt=1;
        //     }
        // }

        public int binarySearch(int n,int k)
        {
            int left=1;
            int right=100000000+5;
            int ans=0;
            while(left<=right)
            {
                int mid = (left+right)/2;
                if(n/mid>=k)
                {
                    left = mid+1;
                    ans=mid;
                }
                else
                {
                    right=mid-1;
                }
            }

            return ans;
        }
        public boolean checkPallindrom(String s)
        {
            char ch[] = s.toCharArray();

            for(int i=0;i<s.length()/2;i++)
            {
                if(ch[i]!=ch[s.length()-1-i])
                    return false;
            }
            return true;
        }

        public void dfs_util(ArrayList<Integer>[] al,boolean vis[],int x,int cnt[],int sts[],int fts[],long sv[])
        {

               vis[x] = true;
               long min=Long.MAX_VALUE;
                sts[cnt[0]]=x+1;
                for(int i=0;i<al[x].size();i++)
                {

                    if(!vis[al[x].get(i)])
                    {
                        cnt[0]++;
                        dfs_util(al, vis, al[x].get(i),cnt,sts,fts,sv);
                        if(sv[al[x].get(i)]<min&&sv[al[x].get(i)]!=-1)
                        {
                            min=sv[al[x].get(i)];
                        }

                    }

                }

                if(sv[x]==-1)
                {
                    if(min==Long.MAX_VALUE)
                    {
                        min=-1;
                    }
                    sv[x]=min;
                }

            return ;
        }

        public void dfs(ArrayList[] al,int sts[],int fts[],long sv[])
        {

           boolean vis[] = new boolean[al.length];
           int cnt[]= new int[2*al.length+2];
           for(int i=0;i<al.length;i++)
           {
                if(!vis[i])
                {

                    dfs_util(al,vis,i,cnt,sts,fts,sv);
                }
           }
        }

        public void remove(ArrayList<Integer>[] al,int x)
        {
            for(int i=0;i<al.length;i++)
            {
                for(int j=0;j<al[i].size();j++)
                {

                    if(al[i].get(j)==x)
                        al[i].remove(j);

                }
            }
        }

        public int gcd(int a, int b)
        {
            if (a == 0)
                return b;
            return gcd(b % a, a);
        }

        public void printDivisors(long n,ArrayList<Long> al)
        {
            // Note that this loop runs till square root
            for (long i=1; i<=Math.sqrt(n); i++)
            {
                if (n%i==0)
                {
                    // If divisors are equal, print only one
                    if (n/i == i)
                        al.add(i);

                    else // Otherwise print both
                        al.add(i);
                        al.add(n/i);
                }
            }
        }

        private void solve(InputReader inp, PrintWriter out1) {
             int n = inp.nextInt();
             int x =inp.nextInt();
             int y = inp.nextInt();

             int arr[] = new int[n];

             for(int i=0;i<n;i++)
             {
                 arr[i] = inp.nextInt();
             }

             if(x>y)
             {
                out1.println(n);
             }

             else
             {
                int count=0;
                for(int i=0;i<n;i++)
                {
                    if(arr[i]<=x)
                    {
                        count++;
                    }

                }
                if(count%2==0)
                    {
                        out1.println(count/2);
                    }
                    else
                    {
                        out1.println((count/2)+1);
                    }
             }

            }

}

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}
class ele{
    long value;
    long i;
    boolean flag;
    public ele(long value,long i)
    {
        this.value = value;
        this.i=i;
        this.flag = false;
    }
}


import java.util.*;

public class Main {

    static class Data implements Comparable<Data> {
        int data, index, color;

        public Data(int d, int i) {
            data = d;
            index = i;
        }

        @Override
        public int compareTo(Data o) {
            if (this.data > o.data)
                return 1;
            else if (this.data < o.data)
                return -1;
            else
                return 0;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();

        int arr[] = new int[n];
        PriorityQueue<Integer> pr = new PriorityQueue<>();
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
            pr.add(arr[i]);
        }

        if (x > y) {
            System.out.println(n);
        } else {
            int count = 0;
            while (!pr.isEmpty()) {
                int z = pr.poll();
                z -= x;

                if (z > 0) {
                    break;
                }

                count++;

                int save = pr.poll();
                save += y;
                pr.add(save);
            }

            System.out.println(count);
        }
    }
}


import java.util.*;

public class Main {

    static class Data implements Comparable<Data> {
        int data, index, color;

        public Data(int d, int i) {
            data = d;
            index = i;
        }

        @Override
        public int compareTo(Data o) {
            if (this.data > o.data)
                return 1;
            else if (this.data < o.data)
                return -1;
            else
                return 0;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();

        int arr[] = new int[n];
        PriorityQueue<Integer> pr = new PriorityQueue<>();
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
            pr.add(arr[i]);
        }

        if (x > y || n == 1) {
            System.out.println(n);
        } else {
            int count = 0;
            while (!pr.isEmpty()) {
                int z = pr.poll();
                z -= x;

                if (z > 0) {
                    break;
                }

                count++;

                int save = pr.poll();
                save += y;
                pr.add(save);
            }

            System.out.println(count);
        }
    }
}


import java.util.*;

public class Main {

    static class Data implements Comparable<Data> {
        int data, index, color;

        public Data(int d, int i) {
            data = d;
            index = i;
        }

        @Override
        public int compareTo(Data o) {
            if (this.data > o.data)
                return 1;
            else if (this.data < o.data)
                return -1;
            else
                return 0;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();

        int arr[] = new int[n];
        PriorityQueue<Integer> pr = new PriorityQueue<>();
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
            pr.add(arr[i]);
        }

        if (x > y || (n == 1 && x >= arr[0])) {
            System.out.println(n);
        } else if (n == 1 && x < arr[0]) {
            System.out.println(0);
        } else {
            int count = 0;
            while (!pr.isEmpty()) {
                int z = pr.poll();
                z -= x;

                if (z > 0) {
                    break;
                }

                count++;

                int save = pr.poll();
                save += y;
                pr.add(save);
            }

            System.out.println(count);
        }
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class DoorBreakAndRep {

    public static void main(String args[]) throws IOException {
        FastReader in = new FastReader();
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        Task.solve(in, out);
        out.close();
    }

    static class Task {

        public static void solve(FastReader in, PrintWriter out) {
            int n = in.nextInt(),x = in.nextInt(),y=in.nextInt();
            int[] a = new int[n];
            for(int i=0;i<n;i++){
                a[i] = in.nextInt();
            }
            if(x>y){
                System.out.println(n);
            }else{
                if(n>=3){
                    if(a[0]<=x && a[n-1]<=x){
                        if(a[1]<=x || a[n-2]<=x){
                            System.out.println(2);
                        }else{
                            System.out.println(1);
                        }
                    }else if(a[0]<=x || a[n-1]<=x){
                        System.out.println(1);
                    }else{
                        System.out.println(0);
                    }
                }else if(n==2){
                    if(a[0]<=x || a[n-1]<=x){
                        System.out.println(1);
                    }else{
                        System.out.println(0);
                    }
                }else{
                    if(a[0]<=x){
                        System.out.println(1);
                    }else{
                        System.out.println(0);
                    }
                }
            }
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class DoorBreakAndRep {

    public static void main(String args[]) throws IOException {
        FastReader in = new FastReader();
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
        Task.solve(in, out);
        out.close();
    }

    static class Task {

        public static void solve(FastReader in, PrintWriter out) {
            int n = in.nextInt(),x = in.nextInt(),y=in.nextInt();
            int[] a = new int[n];
            int m=0;
            for(int i=0;i<n;i++){
                a[i] = in.nextInt();
                if(a[i]<=x){
                    m++;
                }
            }
            if(x>y){
                System.out.println(n);
            }else{
                System.out.println((m+1)/2);
            }
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.util.Scanner;
public class walls {
	public static void main(String [] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		int ans = 0;
		if (x > y) {
			ans = n;
		}
		else {
			int q = 0;
			for (int i = 0; i < n; i++) {
				if (arr[i] <= x) {
					q++;
				}
			}
			if (q % 2 == 0) {
				ans = q / 2;
			}else {
				ans = (q + 1)/2;
			}
		}
		System.out.println(ans);
	}

}


import java.util.Scanner;
public class walls {
	public static void main(String [] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		int ans = 0;
		if (x > y) {
			ans = n;
		}
		else {
			int q = 0;
			for (int i = 0; i < n; i++) {
				if (arr[i] < x) {
					q++;
				}
			}
			ans = q;
		}
		System.out.println(ans);
	}

}


import java.util.Scanner;
public class walls {
	public static void main(String [] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		int ans = 0;
		if (x > y) {
			ans = n;
		}
		else {
			int q = 0;
			for (int i = 0; i < n; i++) {
				if (arr[i] <= x) {
					q++;
				}
			}
			ans = q / 2;
		}
		System.out.println(ans);
	}

}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class DoorsBreakingAndRepairing {
	public static void main(String [] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String [] params = br.readLine().trim().split("\\s+");
		int n = Integer.parseInt(params[0]);
		int x = Integer.parseInt(params[1]);
		int y = Integer.parseInt(params[2]);
		int [] doors = new int[n];
		String [] curDoors = br.readLine().trim().split("\\s+");
		for(int i = 0; i<n; i++) {
			doors[i] = Integer.parseInt(curDoors[i]);
		}
		getResult(doors, x, y);
		br.close();
	}

	static void getResult(int [] doors, int x, int y) {
		if(x>y) {
			System.out.println(doors.length);
			return;
		}
		else {
			int res  = cleanup(doors, x);
			System.out.println((res+1)/2);
		}
	}

	static int cleanup(int [] doors, int x) {
		int ret = 0;
		for(int cur:doors) {
			if(cur<=x) {
				ret++;
			}
		}
		return ret;
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class DoorsBreakingAndRepairing {
	public static void main(String [] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String [] params = br.readLine().trim().split("\\s+");
		int n = Integer.parseInt(params[0]);
		int x = Integer.parseInt(params[1]);
		int y = Integer.parseInt(params[2]);
		int [] doors = new int[n];
		String [] curDoors = br.readLine().trim().split("\\s+");
		for(int i = 0; i<n; i++) {
			doors[i] = Integer.parseInt(curDoors[i]);
		}
		getResult(doors, x, y);
		br.close();
	}

	static void getResult(int [] doors, int x, int y) {
		if(x>y) {
			System.out.println(doors.length);
			return;
		}
		else {
			int res  = cleanup(doors, x);
			System.out.println((res+1)/2);
		}
	}

	static int cleanup(int [] doors, int x) {
		int ret = 0;
		for(int cur:doors) {
			if(cur<x) {
				ret++;
			}
		}
		return ret;
	}
}


import java.util.*;
import java.io.*;
import java.lang.*;

public class Solution
{

	public static int findMinRec(int arr[], int i,
            int sumCalculated,
             int sumTotal)
{
if (i == 0)
return Math.abs((sumTotal-sumCalculated) -
               sumCalculated);

return Math.min(findMinRec(arr, i - 1, sumCalculated
               + arr[i-1], sumTotal),
             findMinRec(arr, i-1,
              sumCalculated, sumTotal));
}

public static int findMin(int arr[], int n)
{

int sumTotal = 0;
for (int i = 0; i < n; i++)
sumTotal += arr[i];

return findMinRec(arr, n, 0, sumTotal);
}

	public static void main(String[] args)
	{
		Scanner s = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n=s.nextInt();
		int x=s.nextInt();
		int y=s.nextInt();

		int arr[]=new int[n];

		for(int i=0;i<n;i++)
			arr[i]=s.nextInt();

		Arrays.sort(arr);

		int d=y-x;
		if(d<0)
			{
			pw.println(n);
			pw.flush();
			pw.close();

			}
		else
		{int count=0;
		for(int i=0;i<n;i++)
		{
			if(arr[i]<=x)
			{arr[i]-=x;
			arr[i+1]+=y;
			count++;
			}
			else
				break;
		Arrays.sort(arr);
		}
		pw.println(count);
		pw.flush();
		pw.close();}
	}

	static class InputReader
	{

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int snext()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
		    {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nextInt();
			}
			return a;
		}

		public String readString()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter
	    {
			public boolean isSpaceChar(int ch);
		}
	}

	public static long mod = 1000000007;
	public static int d;
	public static int p;
	public static int q;

	public static int[] suffle(int[] a,Random gen)
	{
		int n = a.length;
		for(int i=0;i<n;i++)
		{
			int ind = gen.nextInt(n-i)+i;
			int temp = a[ind];
			a[ind] = a[i];
			a[i] = temp;
		}
		return a;
	}

	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}

	public static HashSet<Integer> primeFactorization(int n)
	{
		HashSet<Integer> a =new HashSet<Integer>();
		for(int i=2;i*i<=n;i++)
		{
			while(n%i==0)
			{
				a.add(i);
				n/=i;
			}
		}
		if(n!=1)
			a.add(n);
		return a;
	}

	public static void sieve(boolean[] isPrime,int n)
	{
		for(int i=1;i<n;i++)
			isPrime[i] = true;

		isPrime[0] = false;
		isPrime[1] = false;

		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i] == true)
			{
				for(int j=(2*i);j<n;j+=i)
					isPrime[j] = false;
			}
		}
	}

	public static int GCD(int a,int b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static long GCD(long a,long b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static void extendedEuclid(int A,int B)
	{
		if(B==0)
		{
			d = A;
			p = 1 ;
			q = 0;
		}
		else
		{
			extendedEuclid(B, A%B);
			int temp = p;
			p = q;
			q = temp - (A/B)*q;
		}
	}

	public static long LCM(long a,long b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int LCM(int a,int b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int binaryExponentiation(int x,int n)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static long binaryExponentiation(long x,long n)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static int modularExponentiation(int x,int n,int M)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static int modInverse(int A,int M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static long modInverse(long A,long M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static boolean isPrime(int n)
	{

	    if (n <= 1)  return false;
	    if (n <= 3)  return true;

	    if (n%2 == 0 || n%3 == 0)
	    	return false;

	    for (int i=5; i*i<=n; i=i+6)
	    {
	        if (n%i == 0 || n%(i+2) == 0)
	           return false;
	    }

	    return true;
	}

	static class pair implements Comparable<pair>
	{
		Integer x, y;
		pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if(result==0)
				result = y.compareTo(o.y);

			return result;
		}

		public String toString()
		{
			return x+" "+y;
		}

		public boolean equals(Object o)
		{
			if (o instanceof pair)
		    {
				pair p = (pair)o;
				return (Math.abs(p.x-x)==0 && Math.abs(p.y-y)==0);
			}
			return false;
		}

		public int hashCode()
		{
			return new Long(x).hashCode()*31 + new Long(y).hashCode();
		}
	}
}


import java.util.*;
import java.io.*;
import java.lang.*;

public class Solution
{

	public static int findMinRec(int arr[], int i,
            int sumCalculated,
             int sumTotal)
{
if (i == 0)
return Math.abs((sumTotal-sumCalculated) -
               sumCalculated);

return Math.min(findMinRec(arr, i - 1, sumCalculated
               + arr[i-1], sumTotal),
             findMinRec(arr, i-1,
              sumCalculated, sumTotal));
}

public static int findMin(int arr[], int n)
{

int sumTotal = 0;
for (int i = 0; i < n; i++)
sumTotal += arr[i];

return findMinRec(arr, n, 0, sumTotal);
}

	public static void main(String[] args)
	{
		Scanner s = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n=s.nextInt();
		int x=s.nextInt();
		int y=s.nextInt();

		int arr[]=new int[n];

		for(int i=0;i<n;i++)
			arr[i]=s.nextInt();

		Arrays.sort(arr);

		int d=y-x;
		if(d<0)
			{
			pw.println(n);
			pw.flush();
			pw.close();

			}
		else
		{
		int count=0;
		ArrayList<Integer>al=new ArrayList<>();
		for(int i=0;i<n;i++)
		{
			if(arr[i]<=x)
				count++;
		}
		if(count%2==1)
			count=(count/2)+1;
		else
			count/=2;
		pw.println(count);
		pw.flush();
		pw.close();}
	}

	static class InputReader
	{

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int snext()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
		    {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nextInt();
			}
			return a;
		}

		public String readString()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter
	    {
			public boolean isSpaceChar(int ch);
		}
	}

	public static long mod = 1000000007;
	public static int d;
	public static int p;
	public static int q;

	public static int[] suffle(int[] a,Random gen)
	{
		int n = a.length;
		for(int i=0;i<n;i++)
		{
			int ind = gen.nextInt(n-i)+i;
			int temp = a[ind];
			a[ind] = a[i];
			a[i] = temp;
		}
		return a;
	}

	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}

	public static HashSet<Integer> primeFactorization(int n)
	{
		HashSet<Integer> a =new HashSet<Integer>();
		for(int i=2;i*i<=n;i++)
		{
			while(n%i==0)
			{
				a.add(i);
				n/=i;
			}
		}
		if(n!=1)
			a.add(n);
		return a;
	}

	public static void sieve(boolean[] isPrime,int n)
	{
		for(int i=1;i<n;i++)
			isPrime[i] = true;

		isPrime[0] = false;
		isPrime[1] = false;

		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i] == true)
			{
				for(int j=(2*i);j<n;j+=i)
					isPrime[j] = false;
			}
		}
	}

	public static int GCD(int a,int b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static long GCD(long a,long b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static void extendedEuclid(int A,int B)
	{
		if(B==0)
		{
			d = A;
			p = 1 ;
			q = 0;
		}
		else
		{
			extendedEuclid(B, A%B);
			int temp = p;
			p = q;
			q = temp - (A/B)*q;
		}
	}

	public static long LCM(long a,long b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int LCM(int a,int b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int binaryExponentiation(int x,int n)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static long binaryExponentiation(long x,long n)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static int modularExponentiation(int x,int n,int M)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static int modInverse(int A,int M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static long modInverse(long A,long M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static boolean isPrime(int n)
	{

	    if (n <= 1)  return false;
	    if (n <= 3)  return true;

	    if (n%2 == 0 || n%3 == 0)
	    	return false;

	    for (int i=5; i*i<=n; i=i+6)
	    {
	        if (n%i == 0 || n%(i+2) == 0)
	           return false;
	    }

	    return true;
	}

	static class pair implements Comparable<pair>
	{
		Integer x, y;
		pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if(result==0)
				result = y.compareTo(o.y);

			return result;
		}

		public String toString()
		{
			return x+" "+y;
		}

		public boolean equals(Object o)
		{
			if (o instanceof pair)
		    {
				pair p = (pair)o;
				return (Math.abs(p.x-x)==0 && Math.abs(p.y-y)==0);
			}
			return false;
		}

		public int hashCode()
		{
			return new Long(x).hashCode()*31 + new Long(y).hashCode();
		}
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class solving {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int destroy=scan.nextInt();
		int make=scan.nextInt();
		int ar[]=new int[n];
		int once=0;
		for(int i=0;i<n;i++)
		{
			ar[i]=scan.nextInt();
			if(ar[i]<=destroy)
			{
				once++;
			}
		}

		if(destroy>make)
		{

			System.out.println(n);
			return;
		}else{
			Arrays.sort(ar);
			int x=0;
			int ans=0;
			while(x<n &&ar[x]<=destroy )
			{
				x+=2;
				ans++;
			}
			System.out.println(ans);
		}
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class solving {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int destroy=scan.nextInt();
		int make=scan.nextInt();
		int ar[]=new int[n];
		int once=0;
		for(int i=0;i<n;i++)
		{
			ar[i]=scan.nextInt();
			if(ar[i]<=destroy)
			{
				once++;
			}
		}

		if(destroy>make)
		{

			System.out.println(n);
			return;
		}else{
			Arrays.sort(ar);
			int x=0;
			int ans=0;
			while(ar[x]<=destroy)
			{
				x+=2;
				ans++;
			}
			System.out.println(ans);
		}
	}
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.net.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class cf
{
    public static void main(String args[])
    {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int d=in.nextInt();
        int r=in.nextInt();
        int[] a=new int[n];
        for(int i=0;i<n;i++)
            a[i]=in.nextInt();
        if(r<d)
        {
            System.out.println(n);
            return;
        }
        else if(r==d)
        {
            int c=0,e=0;
            for(int i=0;i<n;i++)
                if(a[i]<r)
                    c++;
                else if(a[i]==r)
                    e++;
            System.out.println(c/2+e);
        }
        else
        {
            int c=0;
            for(int i=0;i<n;i++)
                if(a[i]<r)
                    c++;
            System.out.println((int)Math.ceil((c*1.0)/2));
        }
    }
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.net.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class cf
{
    public static void main(String args[])
    {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int d=in.nextInt();
        int r=in.nextInt();
        int[] a=new int[n];
        for(int i=0;i<n;i++)
            a[i]=in.nextInt();
        if(r<d)
        {
            System.out.println(n);
            return;
        }
        else if(r==d)
        {
            int c=0;
            for(int i=0;i<n;i++)
                if(a[i]<r)
                    c++;
            System.out.println(c/2+n%2);
        }
        else
        {
            int c=0;
            for(int i=0;i<n;i++)
                if(a[i]<r)
                    c++;
                if(c%2==0)
                    c/=2;
                else
                    c=c/2+1;
            System.out.println(c);
        }
    }
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.net.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class cf
{
    public static void merge(int arr[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    public static void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort(arr, l, m);
            sort(arr , m+1, r);
            merge(arr, l, m, r);
        }
    }
    public static void main(String args[])
    {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int d=in.nextInt();
        int r=in.nextInt();
        int[] a=new int[n];
        for(int i=0;i<n;i++)
            a[i]=in.nextInt();
        sort(a,0,n-1);
        if(r>=d)
        {
            int c=0;
            for(int i=0;i<n;i++)
                if(a[i]<=d)
                    c++;
                else
                    break;
            System.out.println((int)Math.ceil((c*1.0)/2));
        }
        else
            System.out.println(n);
    }
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.net.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class cf
{
    public static void main(String args[])
    {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int d=in.nextInt();
        int r=in.nextInt();
        int[] a=new int[n];
        for(int i=0;i<n;i++)
            a[i]=in.nextInt();
        if(r<d)
        {
            System.out.println(n);
            return;
        }
        else if(r==d)
        {
            int c=0,e=0;
            for(int i=0;i<n;i++)
                if(a[i]<r)
                    c++;
                else if(a[i]==r)
                    e++;
            System.out.println((int)Math.ceil((c*1.0)/2)+e-1);
        }
        else
        {
            int c=0;
            for(int i=0;i<n;i++)
                if(a[i]<=r)
                    c++;
                if(c%2==0)
                    c/=2;
                else
                    c=c/2+1;
            System.out.println(c);
        }
    }
}


import java.util.*;
import java.io.*;

public class P1102C {

  private static void solve() {
    int n = nextInt();
    int x = nextInt();
    int y = nextInt();

    if (x > y) {
      System.out.println(n);
      return;
    }

    int cnt = 0;
    for (int i = 0; i < n; i++) {
      int a = nextInt();
      if (a < x) {
        cnt++;
      }
    }

    System.out.println((cnt + 1) / 2);
  }

  private static void run() {
    br = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(System.out);

    solve();

    out.close();
  }

  private static StringTokenizer st;
  private static BufferedReader br;
  private static PrintWriter out;

  private static String next() {
    while (st == null || !st.hasMoreElements()) {
      String s;
      try {
        s = br.readLine();
      } catch (IOException e) {
        return null;
      }
      st = new StringTokenizer(s);
    }
    return st.nextToken();
  }

  private static int nextInt() {
    return Integer.parseInt(next());
  }

  private static long nextLong() {
    return Long.parseLong(next());
  }

  public static void main(String[] args) {
    run();
  }
}


import java.util.*;
import java.io.*;

public class P1102C {

  private static void solve() {
    int n = nextInt();
    int x = nextInt();
    int y = nextInt();

    if (x > y) {
      System.out.println(n);
      return;
    }

    int cnt = 0;
    for (int i = 0; i < n; i++) {
      int a = nextInt();
      if (a <= x) {
        cnt++;
      }
    }

    System.out.println((cnt + 1) / 2);
  }

  private static void run() {
    br = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(System.out);

    solve();

    out.close();
  }

  private static StringTokenizer st;
  private static BufferedReader br;
  private static PrintWriter out;

  private static String next() {
    while (st == null || !st.hasMoreElements()) {
      String s;
      try {
        s = br.readLine();
      } catch (IOException e) {
        return null;
      }
      st = new StringTokenizer(s);
    }
    return st.nextToken();
  }

  private static int nextInt() {
    return Integer.parseInt(next());
  }

  private static long nextLong() {
    return Long.parseLong(next());
  }

  public static void main(String[] args) {
    run();
  }
}


import java.util.Scanner;

public class CF1102C {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();

        if(x > y){
            System.out.println(n);
        } else {

            int targetCnt = 0;

            for(int i = 0; i < n; i++){
                int a = sc.nextInt();
                if(a <= x){
                    targetCnt++;
                }
            }

            int r = targetCnt / 2;
            int d = targetCnt % 2;

            r = d == 0? r : r + 1;

            System.out.println(r);

        }

    }
}


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class CF1102C {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();

        if(x > y){
            System.out.println(n);
        } else {

            int targetCnt = 0;

            for(int i = 0; i < n; i++){
                int a = sc.nextInt();
                if(a <= x){
                    targetCnt++;
                }
            }

            int r = targetCnt / 2;
            int d = targetCnt % 2;

            r = d == 0? r : r + 1;

            System.out.println(r);

        }

    }
}


//package doorbreaking;

import java.util.*;

public class DoorBreaking {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String line[] = input.nextLine().split(" ");
        int n = Integer.parseInt(line[0]);
        int x = Integer.parseInt(line[1]);
        int y = Integer.parseInt(line[2]);
        int doors[] = new int[n];
        int less = 0;

        if(x > y) {
            System.out.println(n);
            System.exit(0);
        }

        line = input.nextLine().split(" ");
        for(int i=0; i<n; i++) {
            doors[i] = Integer.parseInt(line[i]);
            if(doors[i] < x)
                less++;
        }

        System.out.println((less/2) + 1);
    }

}


package doorbreaking;

import java.util.*;

public class DoorBreaking {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String line[] = input.nextLine().split(" ");
        int n = Integer.parseInt(line[0]);
        int x = Integer.parseInt(line[1]);
        int y = Integer.parseInt(line[2]);
        int doors[] = new int[n];
        int less = 0;

        if(x > y) {
            System.out.println(n);
            System.exit(0);
        }

        line = input.nextLine().split(" ");
        for(int i=0; i<n; i++) {
            doors[i] = Integer.parseInt(line[i]);
            if(doors[i] <= x)
                less++;
        }

        if(less % 2 == 1)
            less = (less/2) + 1;
        else
            less = less/2;

        System.out.println(less);
    }

}


//package doorbreaking;

import java.util.*;

public class DoorBreaking {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String line[] = input.nextLine().split(" ");
        int n = Integer.parseInt(line[0]);
        int x = Integer.parseInt(line[1]);
        int y = Integer.parseInt(line[2]);
        int doors[] = new int[n];
        int less = 0;

        if(x > y) {
            System.out.println(n);
            System.exit(0);
        }

        line = input.nextLine().split(" ");
        for(int i=0; i<n; i++) {
            doors[i] = Integer.parseInt(line[i]);
            if(doors[i] <= x)
                less++;
        }

        if(less % 2 == 1)
            less = (less/2) + 1;
        else
            less = less/2;

        System.out.println(less);
    }

}


//package doorbreaking;

import java.util.*;

public class DoorBreaking {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String line[] = input.nextLine().split(" ");
        int n = Integer.parseInt(line[0]);
        int x = Integer.parseInt(line[1]);
        int y = Integer.parseInt(line[2]);
        int doors[] = new int[n];
        int less = 0;

        if(x > y) {
            System.out.println(n);
            System.exit(0);
        }

        line = input.nextLine().split(" ");
        for(int i=0; i<n; i++) {
            doors[i] = Integer.parseInt(line[i]);
            if(doors[i] <= x)
                less++;
        }

        System.out.println((less/2) + 1);
    }

}


import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.time.chrono.MinguoChronology;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Queue;

import java.io.BufferedWriter;
import java.io.IOException;

/*

95 999999999999999 1

 */

public class Main
{
	static long a,b,c,d,e,f,t,l,r,v,n,m,k,x,y,res=0,len,pow;
	static StringBuilder sb,sb1,sb2;
	static String s;
	static long ar[] = new long[100009];
	static long cumu[] = new long[100009];
	static int dis[][] = new int[9][9];
	//static long cumu[] = new long[150009];
	static ArrayList<Long> vi = new ArrayList<>();
	boolean fl = true;

	public static void main(String[] args)throws IOException
	{
		MainFastScan scanner = new MainFastScan();
		MainFastPrint printer = new MainFastPrint();

		n = scanner.nextLong();
		long ami = scanner.nextLong();
		long salvik = scanner.nextLong();
		long cnt = 0;
		for(int i=0; i<n; i++)
		{
			x = scanner.nextLong();
			if(x<=ami) cnt++;
		}

	//	System.out.println(cnt);

		if(ami>salvik)
		{
			res = n;
		}
		else
		{
			if(cnt%2==0) res = cnt/2;
			else res = (cnt/2)+1;
		}

		printer.print(Long.toString(res));
		printer.print("\n");
		printer.close();
	}
}

class MainFastPrint
{
	private final BufferedWriter bw;
	public MainFastPrint(){bw=new BufferedWriter(new OutputStreamWriter(System.out));}
	public void print(String str)throws IOException{bw.append(str);}
	public void printLine(String str)throws IOException{print(str); bw.append("\n");}
	public void close()throws IOException{bw.close();}
	public void flush() throws IOException {bw.flush();}
}

class MainFastScan
{
	private byte[] buf=new byte[1024];
	private int index;
	private InputStream in;
	private int total;
	public MainFastScan()
	{
		in=System.in;
	}
	public int scan()throws IOException
	{
		if(total<0)
			throw new InputMismatchException();
		if(index>=total)
		{
			index=0;
			total=in.read(buf);
			if(total<=0)
				return -1;
		}
		return buf[index++];
	}
	public int nextInt()throws IOException
	{
		int integer=0;
		int n=scan();
		while(isWhiteSpace(n)) n=scan();
		int neg=1;
		if(n=='-')
		{
			neg=-1;
			n=scan();
		}
		while(!isWhiteSpace(n))
		{
			if(n>='0'&&n<='9')
			{
				integer*=10;
				integer+=n-'0';
				n=scan();
			}
			else throw new InputMismatchException();
		}
		return neg*integer;
	}

	public long nextLong()throws IOException
	{
		long res=0;
		int n = scan();
		while(isWhiteSpace(n)) n=scan();
		int neg=1;
		if(n=='-')
		{
			neg=-1;
			n=scan();
		}
		while(!isWhiteSpace(n))
		{
			if(n>='0'&&n<='9')
			{
				res *= 10;
				res += n-'0';
				n=scan();
			}
			else throw new InputMismatchException();
		}
		return neg*res;
	}

	public double nextDouble()throws IOException
	{
		double doub=0;
		int n=scan();
		while(isWhiteSpace(n)) n=scan();
		int neg=1;
		if(n=='-')
		{
			neg=-1;
			n=scan();
		}
		while(!isWhiteSpace(n)&&n!='.')
		{
			if(n>='0'&&n<='9')
			{
				doub*=10;
				doub+=n-'0';
				n=scan();
			}
			else throw new InputMismatchException();
		}
		if(n=='.')
		{
			n=scan();
			double temp=1;
			while(!isWhiteSpace(n))
			{
				if(n>='0'&&n<='9')
				{
					temp/=10;
					doub+=(n-'0')*temp;
					n=scan();
				}
				else throw new InputMismatchException();
			}
		}
		return doub*neg;
	}
	public String nextWord()throws IOException
	{
		StringBuilder sb=new StringBuilder();
		int n=scan();
		while(isWhiteSpace(n)) n=scan();
		while(!isWhiteSpace(n))
		{
			sb.append((char)n);
			n=scan();
		}
		return sb.toString();
	}
	public String nextLine()throws IOException
	{
		StringBuilder sb=new StringBuilder();
		int n=scan();
		while(isWhiteSpaceLine(n)) n=scan();
		while(!isWhiteSpaceLine(n))
		{
			sb.append((char)n);
			n=scan();
		}
		return sb.toString();
	}
	private boolean isWhiteSpace(int n)
	{
		if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
			return true;
		return false;
	}
	private boolean isWhiteSpaceLine(int n)
	{
		if(n=='\n'||n=='\r'||n=='\t'||n==-1)
			return true;
		return false;
	}
}