#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef unsigned long long int ull ;

using namespace std;

const int M=1e9+7;
const char nl = '\n';

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n , x , y ;
    cin >> n >> x >> y ;
    if (  x > y ){
        cout << n ;
        return 0 ;
    }
    vector<ll> a(n) ;
    for (int i = 0 ; i < n ; i++)
        cin >> a[i] ;
    sort(all(a));
    int ans = 0;
    for (int i = 0; i < n; i += 2) {
        if (a[i] <= x) {
            ++ans;
        }
    }
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef unsigned long long int ull ;

using namespace std;

const int M=1e9+7;
const char nl = '\n';

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n , x , y ;
    cin >> n >> x >> y ;
    if (  x > y ){
        cout << n ;
        return 0 ;
    }
    vector<ll> a(n) ;
    sort(all(a));
    int ans = 0;
    for (int i = 0; i < n; i += 2) {
        if (a[i] <= x) {
            ++ans;
        }
    }
    cout << ans ;
    return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef unsigned long long int ull ;

using namespace std;

const int M=1e9+7;
const char nl = '\n';

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n , x , y ;
    cin >> n >> x >> y ;
    if (  x > y ){
        cout << n ;
        return 0 ;
    }
    int ans = 0 ;
    while(n--){
        int o ;
        cin >> o ;
        if ( o >= x)
            ans++;
    }
    cout << (ans+1)/2 ;
    return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef unsigned long long int ull ;

using namespace std;

const int M=1e9+7;
const char nl = '\n';

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n , x , y ;
    cin >> n >> x >> y ;
    if (  x > y ){
        cout << n ;
        return 0 ;
    }
    int ans = 0 ;
    while(n--){
        int o ;
        cin >> o ;
        if ( o >= x)
            ans++;
    }
    cout << ans ;
    return 0;
}


#include<cstdio>
using namespace std;
int main(){
	int n,x,y,ans=0,a;
	scanf("%d%d%d",&n,&x,&y);
	if(x>y)printf("%d",n);
	else{
		for(int i=0;i<n;i++){
			scanf("%d",&a);
			if(a<=x)ans++;
		}if(ans>=1)printf("%d",(n+1)/2);else printf("0");
	}
	return 0;
}


#include<cstdio>
using namespace std;
int main(){
	int n,x,y,ans=0,a;
	scanf("%d%d%d",&n,&x,&y);
	if(x>y)printf("%d",&n);
	else{
		for(int i=0;i<n;i++){
			scanf("%d",&a);
			if(a<=x)ans++;
		}if(ans>=3)printf("2");
		else if(ans>=1)printf("1");else printf("0");
	}
	return 0;
}


#include<cstdio>
using namespace std;
int main(){
	int n,x,y,ans=0,a;
	scanf("%d%d%d",&n,&x,&y);
	if(x>y)printf("%d",n);
	else{
		for(int i=0;i<n;i++){
			scanf("%d",&a);
			if(a<=x)ans++;
		}if(ans>=3)printf("2");
		else if(ans>=1)printf("1");else printf("0");
	}
	return 0;
}


#include<cstdio>
using namespace std;
int main(){
	int n,x,y,ans=0,a;
	scanf("%d%d%d",&n,&x,&y);
	if(x>y)printf("%d",n);
	else{
		for(int i=0;i<n;i++){
			scanf("%d",&a);
			if(a<=x)ans++;
		}if(ans>=1)printf("%d",(ans+1)/2);else printf("0");
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define lpri(n) printf("%lld", n)
#define pri(n) printf("%d", n)
#define pln() printf("\n")
#define priln(n) printf("%d\n", n)
#define lpriln(n) printf("%lld\n", n)
#define rep(i, init, n) for (int i = init; i < n; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd _gcd
using namespace std;
const ll mod = 1e9 + 7;
const int N = 998244353;
int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int n, x, y, cnt = 0;
    cin>>n>>x>>y;
    int a[n];
    rep(i, 0, n) cin>>a[i];
    if(x > y) cout<<n;
    else{
        sort(a, a + n);
        int it = upper_bound(a, a + n, x) - a;
        cout<<it / 2 + 1;
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define lpri(n) printf("%lld", n)
#define pri(n) printf("%d", n)
#define pln() printf("\n")
#define priln(n) printf("%d\n", n)
#define lpriln(n) printf("%lld\n", n)
#define rep(i, init, n) for (int i = init; i < n; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd _gcd
using namespace std;
const ll mod = 1e9 + 7;
const int N = 998244353;
int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int n, x, y, cnt = 0;
    cin>>n>>x>>y;
    int a[n];
    rep(i, 0, n) cin>>a[i];
    if(x > y) cout<<n;
    else{
        sort(a, a + n);
        int it = upper_bound(a, a + n, x) - a;
        cout<<it / 2 + (it & 1);
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define lpri(n) printf("%lld", n)
#define pri(n) printf("%d", n)
#define pln() printf("\n")
#define priln(n) printf("%d\n", n)
#define lpriln(n) printf("%lld\n", n)
#define rep(i, init, n) for (int i = init; i < n; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd _gcd
using namespace std;
const ll mod = 1e9 + 7;
const int N = 998244353;
int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int n, x, y, cnt = 0;
    int a[n];
    rep(i, 0, n) cin>>a[i];
    if(x > y) cout<<n;
    else{
        sort(a, a + n);
        int it = upper_bound(a, a + n, x) - a;
        cout<<it / 2 + it & 1;
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define lpri(n) printf("%lld", n)
#define pri(n) printf("%d", n)
#define pln() printf("\n")
#define priln(n) printf("%d\n", n)
#define lpriln(n) printf("%lld\n", n)
#define rep(i, init, n) for (int i = init; i < n; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd _gcd
using namespace std;
const ll mod = 1e9 + 7;
const int N = 998244353;
int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int n, x, y, cnt = 0;
    int a[n];
    rep(i, 0, n) cin>>a[i];
    if(x > y) cout<<n;
    else{
        sort(a, a + n);
        int it = upper_bound(a, a + n, x) - a;
        cout<<it / 2 + 1;
    }
    return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
#define For(i,a,b) for(int i=a; i<=(b); ++i)
#define Fod(i,a,b) for(int i=a; i>=(b); --i)
#define pback push_back
#define speed ios::sync_with_stdio(false);
#define off_ cin.tie(0); cout.tie(0);
#define TLE 7e7 + 1
#define sz(x) (int) x.size()

using namespace std;
const int maxn = 2e5 + 5, maxm = 17, N = 1048576;
const int mod = 99824453;
const long long oo  = 1e15 + 7;
typedef long long LL;
typedef pair<int, int> ii;

int n, a[maxn], x, y;
int main()
{
    cin >> n >> x >> y;
    For(i, 1, n) cin >> a[i];
    if (x > y) cout << n;
    } else {
        int ans = 0;
        For(i, 1, n) ans += (a[i] <= x);
        cout << (ans +1)/2;
    }
}


#include<bits/stdc++.h>
#define fi first
#define se second
#define For(i,a,b) for(int i=a; i<=(b); ++i)
#define Fod(i,a,b) for(int i=a; i>=(b); --i)
#define pback push_back
#define speed ios::sync_with_stdio(false);
#define off_ cin.tie(0); cout.tie(0);
#define TLE 7e7 + 1
#define sz(x) (int) x.size()

using namespace std;
const int maxn = 2e5 + 5, maxm = 17, N = 1048576;
const int mod = 99824453;
const long long oo  = 1e15 + 7;
typedef long long LL;
typedef pair<int, int> ii;

int n, a[maxn], x, y;
int main()
{
    cin >> n >> x >> y;
    For(i, 1, n) cin >> a[i];
    if (x > y) cout << n;
    else if (x == y) {
        int ans = 0;
        For(i, 1, n) ans += (a[i] <= x);
        cout << ans/2;
    } else {
        int ans = 0;
        For(i, 1, n) ans += (a[i] < x);
        cout << (ans +1)/2;
    }
}


#include<bits/stdc++.h>
#define fi first
#define se second
#define For(i,a,b) for(int i=a; i<=(b); ++i)
#define Fod(i,a,b) for(int i=a; i>=(b); --i)
#define pback push_back
#define speed ios::sync_with_stdio(false);
#define off_ cin.tie(0); cout.tie(0);
#define TLE 7e7 + 1
#define sz(x) (int) x.size()

using namespace std;
const int maxn = 2e5 + 5, maxm = 17, N = 1048576;
const int mod = 99824453;
const long long oo  = 1e15 + 7;
typedef long long LL;
typedef pair<int, int> ii;

LL n;
int main()
{
    cin >> n >> x >> y;
    For(i, 1, n) cin >> a[i];
    if (x > y) cout << n;
    else if (x == y) {
        int ans = 0;
        For(i, 1, n) ans += (a[i] <= x);
        cout << ans/2;
    } else {
        int ans = 0;
        For(i, 1, n) ans += (a[i] < x);
        cout << (ans +1)/2;
    }
}


#include<bits/stdc++.h>
#define fi first
#define se second
#define For(i,a,b) for(int i=a; i<=(b); ++i)
#define Fod(i,a,b) for(int i=a; i>=(b); --i)
#define pback push_back
#define speed ios::sync_with_stdio(false);
#define off_ cin.tie(0); cout.tie(0);
#define TLE 7e7 + 1
#define sz(x) (int) x.size()

using namespace std;
const int maxn = 2e5 + 5, maxm = 17, N = 1048576;
const int mod = 99824453;
const long long oo  = 1e15 + 7;
typedef long long LL;
typedef pair<int, int> ii;

int n, a[maxn], x, y;
int main()
{
    cin >> n >> x >> y;
    For(i, 1, n) cin >> a[i];
    if (x > y) cout << n;
    else if (x == y) {
        int ans = 0;
        For(i, 1, n) ans += (a[i] <= x);
        cout << (ans+1)/2;
    } else {
        int ans = 0;
        For(i, 1, n) ans += (a[i] < 2*x);
        cout << (ans +1)/2;
    }
}


#include<bits/stdc++.h>
#define fi first
#define se second
#define For(i,a,b) for(int i=a; i<=(b); ++i)
#define Fod(i,a,b) for(int i=a; i>=(b); --i)
#define pback push_back
#define speed ios::sync_with_stdio(false);
#define off_ cin.tie(0); cout.tie(0);
#define TLE 7e7 + 1
#define sz(x) (int) x.size()

using namespace std;
const int maxn = 2e5 + 5, maxm = 17, N = 1048576;
const int mod = 99824453;
const long long oo  = 1e15 + 7;
typedef long long LL;
typedef pair<int, int> ii;

int n, a[maxn], x, y;
int main()
{
    cin >> n >> x >> y;
    For(i, 1, n) cin >> a[i];
    if (x > y) cout << n;
    else {
        int ans = 0;
        For(i, 1, n) ans += (a[i] <= x);
        cout << (ans +1)/2;
    }
}


#include<bits/stdc++.h>
#define fi first
#define se second
#define For(i,a,b) for(int i=a; i<=(b); ++i)
#define Fod(i,a,b) for(int i=a; i>=(b); --i)
#define pback push_back
#define speed ios::sync_with_stdio(false);
#define off_ cin.tie(0); cout.tie(0);
#define TLE 7e7 + 1
#define sz(x) (int) x.size()

using namespace std;
const int maxn = 2e5 + 5, maxm = 17, N = 1048576;
const int mod = 99824453;
const long long oo  = 1e15 + 7;
typedef long long LL;
typedef pair<int, int> ii;

int n, a[maxn], x, y;
int main()
{
    cin >> n >> x >> y;
    For(i, 1, n) cin >> a[i];
    if (x > y) cout << n;
    else if (x == y) {
        int ans = 0;
        For(i, 1, n) ans += (a[i] <= x);
        cout << (ans+1)/2;
    } else {
        int ans = 0;
        For(i, 1, n) ans += (a[i] < x);
        cout << (ans +1)/2;
    }
}


/* ****Shrey97**** */

#include <bits/stdc++.h>

#define hell 1000000007
#define N 100005

using namespace std;

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n, x, y;
	cin >> n >> x>>y;
	int a[n], c=0;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
		if(a[i]<x)
		{
			c++;
		}
	}
	if(x > y)
	{
		cout << n;
	}
	else
	{
		cout << (c+1)/2;
	}
	return 0;
}


/* ****Shrey97**** */

#include <bits/stdc++.h>

#define hell 1000000007
#define N 100005

using namespace std;

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n, x, y;
	cin >> n >> x>>y;
	int a[n], c=0;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
		if(a[i]<x)
		{
			c++;
		}
	}
	if(x > y)
	{
		cout << n;
	}
	else if(x==y)
	{
		cout << c;
	}
	else
	{
		cout << (c+1)/2;
	}
	return 0;
}


/* ****Shrey97**** */

#include <bits/stdc++.h>

#define hell 1000000007
#define N 100005

using namespace std;

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n, x, y;
	cin >> n >> x>>y;
	int a[n], c=0;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
		if(a[i]<=x)
		{
			c++;
		}
	}
	if(x > y)
	{
		cout << n;
	}
	else
	{
		cout << (c+1)/2;
	}
	return 0;
}


/* ****Shrey97**** */

#include <bits/stdc++.h>

#define hell 1000000007
#define N 100005

using namespace std;

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n, x, y;
	cin >> n >> x>>y;
	int a[n], c=0;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
		if(a[i]<x)
		{
			c++;
		}
	}
	if(x >= y)
	{
		cout << n;
	}
	else
	{
		cout << (c+1)/2;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int c=0,n,x,y,i,s;
    cin>>n>>x>>y;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        if(x>=a[i])
            c++;
        else
        {
            if(y>=x)
                break;
            else
                c++;
        }
    }
    cout<<c<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int c=0,n,x,y,i,s;
    cin>>n>>x>>y;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        if(x>=a[i])
            c++;
        else
        {
            if(y>x)
                break;
            else
                c++;
        }
    }
    cout<<c<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int c=0,n,x,y,i,s,f=0;
    cin>>n>>x>>y;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        if(x>=a[i])
            c++;
        else
        {
            if(y>=x)
               f++;
            else
                c++;
                 if(f!=0 && i<n-1)
                a[i+1]+=y;
        }

    }
    cout<<c<<endl;
    return 0;
}


#include<bits/stdc++.h>

using namespace std ;

long long int x[50000]={} ;

int main () {

    long long int n , t , i , j , k ,mx=0 ,x,y,cnt=0 ,ans=0 ;
    cin >>n>>x>>y ;
    long long int a[n] ;
    for (i=0;i<n;i++){
        cin >> a[i] ;
        if (a[i]<=x)
            cnt++ ;
    }
    if (x<=y){
        if (cnt%2==0)
            ans=cnt/2;
        else
            ans=cnt/2+1 ;
    }
    else
    {
        ans= n;
    }
    //ami ei code copy marsi from RUH
    cout << ans <<endl ;
    return 0 ;
}


#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

    int a[100*1000];
    int b[100*1000+1];
    int main()
    {
        int n,x,y;
        scanf("%d",&n);
        scanf("%d",&x);
        scanf("%d",&y);
       // printf("%d\n\n\n",x);
        //int res=0;
        //int eq=0;
        bool ro=false;
        int i;
            for(i=0;i<n;i++){
            scanf("%d",&a[i]);
            if(a[i]>x)
                b[i]=-1;
            else{
                b[i]=max(0,(x-a[i])/y);

                }
           // printf("b[%d]=%d\n",i,b[i]);

            //if(a[i]<=x)res++;
            //if(a[i]==x)eq++;
        }

        b[n]=-2;
        sort(b,b+n);
        int res=0;
        int xi=1;
        for(int i=n-1;i>0;i--){
            if(b[i]==b[i-1]&&b[i]>0)xi++;

            else{
                res+=(xi+1)/2;
               // printf("xi is:  %d\n",xi);
                xi=1;
                ro=true;
            }

        }
        if(!ro){
            res+=(xi+1)/2;
            }

        if(x>y)printf("%d",n);
        else{
            printf("%d",res);

        }

        return 0;
    }


#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

    int a[100*1000];
    int b[100*1000+1];
    int main()
    {
        int n,x,y;
        scanf("%d",&n);
        scanf("%d",&x);
        scanf("%d",&y);
       // printf("%d\n\n\n",x);
        //int res=0;
        //int eq=0;
        bool ro=false;
        int i;
            for(i=0;i<n;i++){
            scanf("%d",&a[i]);
            if(a[i]>x)
                b[i]=-1;
            else{
                b[i]=max(0,(x-a[i])/y);

                }
           // printf("b[%d]=%d\n",i,b[i]);

            //if(a[i]<=x)res++;
            //if(a[i]==x)eq++;
        }

        b[n]=-2;
        sort(b,b+n);
        int res=0;
        int xi=1;
        for(int i=n-1;i>0;i--){
            if(b[i]==b[i-1])xi++;

            else{
                res+=(xi+1)/2;
               // printf("xi is:  %d\n",xi);
                xi=1;
                ro=true;
            }

        }
        if(!ro){
            res+=(xi+1)/2;
            }

        if(x>y)printf("%d",n);
        else{
            printf("%d",res);

        }

        return 0;
    }


#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

    int a[100*1000];
    int b[100*1000+1];
    int main()
    {
        int n,x,y;
        scanf("%d",&n);
        scanf("%d",&x);
        scanf("%d",&y);
       // printf("%d\n\n\n",x);
        //int res=0;
        //int eq=0;
        bool ro=false;
        int i;
            for(i=0;i<n;i++){
            scanf("%d",&a[i]);
            if(a[i]>x)
                b[i]=-1;
            else{
                b[i]=max(0,(x-a[i])/y);

                }
           // printf("b[%d]=%d\n",i,b[i]);

            //if(a[i]<=x)res++;
            //if(a[i]==x)eq++;
        }

        b[n]=-2;
        sort(b,b+n);
        int res=0;
        int xi=1;
        for(int i=n-1;i>0;i--){
            if(b[i]==b[i-1])xi++;

            else{
                res+=(xi+1)/2;
               // printf("xi is:  %d\n",xi);
                xi=1;
                ro=true;
            }

        }
        if(!ro&&b[n-1]>=0){
            res+=(xi+1)/2;
            }

        if(x>y)printf("%d",n);
        else{
            printf("%d",res);

        }

        return 0;
    }


#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

    int a[100*1000];
    int b[100*1000+1];
    int main()
    {
        int n,x,y;
        scanf("%d",&n);
        scanf("%d",&x);
        scanf("%d",&y);
       // printf("%d\n\n\n",x);
        //int res=0;
        //int eq=0;
        bool ro=false;
        int i;
            for(i=0;i<n;i++){
            scanf("%d",&a[i]);
            if(a[i]>x)
                b[i]=-1;
            else{
                b[i]=max(0,(x-a[i])/y);

                }
           // printf("b[%d]=%d\n",i,b[i]);

            //if(a[i]<=x)res++;
            //if(a[i]==x)eq++;
        }

        b[n]=-2;
        sort(b,b+n);
        int res=0;
        int xi=1;
        for(int i=n-1;i>0;i--){
            if(b[i]==b[i-1]&&b[i]>=0)xi++;

            else{
                res+=(xi+1)/2;
               // printf("xi is:  %d\n",xi);
                xi=1;
                ro=true;
            }

        }
        if(!ro){
            res+=(xi+1)/2;
            }

        if(x>y)printf("%d",n);
        else{
            printf("%d",res);

        }

        return 0;
    }


#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

    int a[100*1000];
    int b[100*1000+1];
    int main()
    {
        int n,x,y;
        scanf("%d",&n);
        scanf("%d",&x);
        scanf("%d",&y);
        //int res=0;
        //int eq=0;
        for(int i=0;i<n;i++){
            scanf("%d",&a[i]);
            if(a[i]>x)
                b[i]=-1;
            else{
                b[i]=max(0,(x-a[i])/y);

                }
           // printf("b[%d]=%d\n",i,b[i]);

            //if(a[i]<=x)res++;
            //if(a[i]==x)eq++;
        }
        b[n]=-2;
        sort(b,b+n);
        int res=0;
        int xi=1;
        for(int i=n-1;i>0;i--){
            if(b[i]==b[i-1])xi++;

            else{
                res+=(xi+1)/2;
               // printf("xi is:  %d\n",xi);
                xi=1;
            }

        }

        if(x>y)printf("%d",n);
        else{
            printf("%d",res);

        }

        return 0;
    }


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(void)
{
    int n,x,y,ans = 0;
    cin >> n >> x >> y;
    vector<int>doors(n);
    for(int i = 0;i < n;i++)
        cin >> doors[i];
    if(x > y)
    {
        cout << n << endl;
        //system("pause");
        return 0;
    }
    sort(doors.begin(),doors.end());
    int cnt = 0;
    for(int i = 0;doors[i] <= x;i++)
        cnt++;
    cout << ceil(cnt / 2) << endl;
    //system("pause");
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(void)
{
    int n,x,y,ans = 0,cnt = 0;
    cin >> n >> x >> y;
    int tmp;
    for(int i = 0;i < n;i++)
    {
        cin >> tmp;
        if(tmp <= x)
            cnt++;
    }
    if(x > y)
    {
        cout << n << endl;
        //system("pause");
        return 0;
    }
    cout << ceil(cnt / 2.0) << endl;
    //system("pause");
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(void)
{
    int n,x,y,ans = 0;
    cin >> n >> x >> y;
    vector<int>doors(n);
    for(int i = 0;i < n;i++)
        cin >> doors[i];
    if(x > y)
    {
        cout << n << endl;
        //system("pause");
        return 0;
    }
    sort(doors.begin(),doors.end());
    int cnt = 0;
    for(int i = 0;doors[i] < x;i++)
        cnt++;
    cout << ceil(cnt / 2) + 1 << endl;
    //system("pause");
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(void)
{
    int n,x,y,ans = 0,cnt = 0;
    cin >> n >> x >> y;
    int tmp;
    for(int i = 0;i < n;i++)
    {
        cin >> tmp;
        if(tmp < x)
            cnt++;
    }
    if(x > y)
    {
        cout << n << endl;
        //system("pause");
        return 0;
    }
    cout << ceil(cnt / 2.0) << endl;
    //system("pause");
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(void)
{
    int n,x,y,ans = 0,cnt = 0;
    cin >> n >> x >> y;
    int tmp;
    for(int i = 0;i < n;i++)
    {
        cin >> tmp;
        if(tmp <= x)
            cnt++;
    }
    if(x > y)
    {
        cout << n << endl;
        system("pause");
        return 0;
    }
    cout << ceil(cnt / 2.0) << endl;
    system("pause");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,x,y,count=0;
int main()
{
	cin>>n>>x>>y;
	for(int i=0,a;i<n;i++)
	{
		cin>>a;
		if(a<=x) t++;
	}
	if(x>y)
		cout<<n;
	else
		cout<<(count+1)/2;
}


#include<bits/stdc++.h>
using namespace std;
int n,x,y,count=0;
int main()
{
	cin>>n>>x>>y;
	for(int i=0,a;i<n;i++)
	{
		cin>>a;
		if(a<=x) count++;
	}
	if(x>y)
		cout<<n;
	else
		cout<<(count+1)/2;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{

	int n,x,i,y,a[102];
	cin>>n>>x>>y;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	int count=0;
	for(i=0;i<n;i++)
	{
		if((a[i]-x)<=0)
		{
			count++;
		}
		else if(((a[i]-x)+y)<=x)
		 {
		 	count++;
		 }
		 else
		 {
		 	break;
		 }
	}
	cout<<count<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int n,x,y,coun=0,a;
int main()
{
	cin>>n>>x>>y;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		if(a<=x)
		{
		coun++;
	}
	}
	if(x>y)
		cout<<n;
	else
		cout<<(coun+1)/2;
}


# include <bits/stdc++.h>
# define mp make_pair
# define pb push_back
using namespace std;

int main(){
	int n, k, a, i, j, l;
	cin >> n >> k;
	int count[5001]{0};
	int color[n], cocol[k];
	int max = 0;
	bool flag = true;
	for(i=0;i<n;i++){
		cin >> a;
		count[a]++;
		color[i]=count[a];
		cocol[color[i]]++;
		if(cocol[color[i]]>max){
			max = cocol[color[i]];
		}
		if(count[a]>k){
			flag = false;
			break;
		}
	}
	cout << max << endl;
	if(not flag){
		cout << "NO";
	}
	else{
		cout << "YES" << endl;

		for(j=0; j<n; j++){
			if(max<k){
				if(cocol[j]>1){
					for(l=n-1; l>=0; l--){
						if(color[l]==j){
							color[l]==k;
							break;
						}
					}
				}
			}
		cout << color[j] << " ";
		}
	}
}


# include <bits/stdc++.h>
# define mp make_pair
# define pb push_back
using namespace std;

int main(){
	int n, x, y;
	cin >> n >> x >> y;
	int a[n];
	for(int i=0;i<n; i++){
		cin >> a[i];
	}
	if(x>y){
		cout << n;
	}
	else{
		sort(a, a+n);
		int i = 0;
		int count=0;
		while(a[i]<=x){
			count++;
			a[i+1]+=y;
			sort(a, a+n);
			i++;
		}
		cout << count;
	}
}


# include <bits/stdc++.h>
# define mp make_pair
# define pb push_back
using namespace std;

int main(){
	int n, k, a, i, j, l;
	cin >> n >> k;
	int count[5001]{0};
	int color[n], cocol[k];
	int max = 0;
	bool flag = true;
	for(i=0;i<n;i++){
		cin >> a;
		count[a]++;
		color[i]=count[a];
		cocol[color[i]]++;
		if(cocol[color[i]]>max){
			max = cocol[color[i]];
		}
		if(count[a]>k){
			flag = false;
			break;
		}
	}
	if(not flag){
		cout << "NO";
	}
	else{
		cout << "YES" << endl;

		for(j=0; j<n; j++){
			if(max<k){
				if(cocol[j]>1){
					for(l=n-1; l>=0; l--){
						if(color[l]==j){
							color[l]==k;
							break;
						}
					}
				}
			}
		cout << color[j] << " ";
		}
	}
}


# include <bits/stdc++.h>
# define mp make_pair
# define pb push_back
using namespace std;

int main(){
	int n, x, y;
	cin >> n >> x >> y;
	int a[n];
	for(int i=0;i<n; i++){
		cin >> a[i];
	}
	if(x>y){
		cout << n;
	}
	else{
		sort(a, a+n);
		int i = 0;
		int count=0;
		while(a[i]<x){
			count++;
			a[i+1]+=y;
			sort(a, a+n);
			i++;
		}
		cout << count;
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,y,cnt = 0;
    cin>>n>>x>>y;
    int arr[n];
    for(int i=0; i<n; i++)
    {
        cin>>arr[i];
        if(arr[i]<=x)
            cnt++;
    }
    if(x>y)
        cout<<n<<endl;
    else if(cnt == 0)
        cout<<0<<endl;
    else
    {
        int ans =  (cnt+1)/2;
        cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,y,cnt = 0;
    cin>>n>>x>>y;
    int arr[n];
    for(int i=0; i<n; i++)
    {
        cin>>arr[i];
        if(arr[i]>=x)
            cnt++;
    }
    if(x>y)
        cout<<n<<endl;
    else
    {
        int ans = 1 + cnt/2;
        cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,y,cnt = 0;
    cin>>n>>x>>y;
    int arr[n];
    for(int i=0; i<n; i++)
    {
        cin>>arr[i];
        if(arr[i]<=x)
            cnt++;
    }
    if(cnt == 0)
        cout<<0<<endl;
    else if(x>y)
        cout<<n<<endl;
    else
    {
        int ans =  (cnt+1)/2;
        cout<<ans<<endl;
    }
}


// Icanchangemymind
#include<iostream>
#include<math.h>
using namespace std;
int main(){
   int n,x,y;
   cin>>n>>x>>y;
   int a[100];
   for(int i=0;i<n;i++){
    cin>>a[i];
   }
   if(x>y){
    cout<<n;
    return 0;
   }
   for(int i=0;i<n;i++){
    for(int j=0;j<n-1;j++){
        if(a[j]>a[j+1]){
            int temp=a[j];
            a[j]=a[j+1];
            a[j+1]=a[j];
        }
    }
   }
   // Sorted
   int num=0;
   for(int i=0;i<n;i++){
    if(a[i] > x)
        break;
     num++;
   }
   cout<<num/2;
return 0;
}


// Icanchangemymind
#include<iostream>
#include<math.h>
using namespace std;
int main(){
   int n,x,y;
   cin>>n>>x>>y;
   int a[100];
   for(int i=0;i<n;i++){
    cin>>a[i];
   }
   if(x>y){
    cout<<n;
    return 0;
   }
   for(int i=0;i<n;i++){
    for(int j=0;j<n-1;j++){
        if(a[j]>a[j+1]){
            int temp=a[j];
            a[j]=a[j+1];
            a[j+1]=temp;
        }
    }
   }
   // Sorted
   int num=0;
   for(int i=0;i<n;i++){
    if(a[i] > x)
        break;
     num++;
   }
   if(num%2 == 1)
    cout<<num/2 + 1;
    if(num%2 == 0)
    cout<<num/2;
return 0;
}


// Icanchangemymind
#include<iostream>
#include<math.h>
using namespace std;
int main(){
   int n,x,y;
   cin>>n>>x>>y;
   int a[100];
   for(int i=0;i<n;i++){
    cin>>a[i];
   }
   if(x>y){
    cout<<n;
    return 0;
   }
   for(int i=0;i<n;i++){
    for(int j=0;j<n-1;j++){
        if(a[j]>a[j+1]){
            int temp=a[j];
            a[j]=a[j+1];
            a[j+1]=temp;
        }
    }
   }
   // Sorted
   int num=0;
   for(int i=0;i<n;i++){
    if(a[i] > x)
        break;
     num++;
   }
   cout<<num/2;
return 0;
}


// Icanchangemymind
#include<iostream>
#include<math.h>
using namespace std;
int main(){
   int n,x,y;
   cin>>n>>x>>y;
   int a[100];
   for(int i=0;i<n;i++){
    cin>>a[i];
   }
   if(x>y){
    cout<<n;
    return 0;
   }
   for(int i=0;i<n;i++){
    for(int j=0;j<n-1;j++){
        if(a[j]>a[j+1]){
            int temp=a[j];
            a[j]=a[j+1];
            a[j+1]=temp;
        }
    }
   }
   // Sorted
   int num=0;
   for(int i=0;i<n;i++){
    if(a[i] > x)
        break;
     num++;
   }
   if(n%2 == 1)
    cout<<num/2 + 1;
    if(n%2 == 0)
    cout<<num/2;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[105];
int main()
{
	int n,x,y;
	scanf("%d%d%d",&n,&x,&y);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	if(x>y)
	{
		printf("%d\n",n);
		return 0;
	}
	sort(a+1,a+n+1);
	int mark=-1;
	for(int i=1;i<=n;++i)
	{
		if(a[i]>x)
		{
			mark=i-1;
			break;
		}
	}
	if(mark%2==0)printf("%d\n",mark/2);else printf("%d\n",mark/2+1);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[105];
int main()
{
	int n,x,y;
	scanf("%d%d%d",&n,&x,&y);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	if(x>y)
	{
		printf("%d\n",n);
		return 0;
	}
	sort(a+1,a+n+1);
	int mark=-1;
	for(int i=1;i<=n;++i)
	{
		if(a[i]>x)
		{
			mark=i-1;
			break;
		}
	}
	if(a[n]<x)mark=n;
	if(mark%2==0)printf("%d\n",mark/2);else printf("%d\n",mark/2+1);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[105];
int main()
{
	int n,x,y;
	scanf("%d%d%d",&n,&x,&y);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	if(x>y)
	{
		printf("%d\n",n);
		return 0;
	}
	sort(a+1,a+n+1);
	int mark=-1;
	for(int i=1;i<=n;++i)
	{
		if(a[i]>x)
		{
			mark=i-1;
			break;
		}
	}
	if(a[n]<=x)mark=n;
	if(mark%2==0)printf("%d\n",mark/2);else printf("%d\n",mark/2+1);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[1005];
int main()
{
	int n,x,y;
	scanf("%d%d%d",&n,&x,&y);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	if(x>y)
	{
		printf("%d\n",n);
		return 0;
	}
	sort(a+1,a+n+1);
	int mark=-1;
	for(int i=1;i<=n;++i)
	{
		if(a[i]>x)
		{
			mark=i-1;
			break;
		}
	}
	if(a[n]<=x)mark=n;
	if(mark%2==0)printf("%d\n",mark/2);else printf("%d\n",mark/2+1);
	return 0;
}


#include<iostream>
using namespace std;

int findZeros(vector<int> A, int n, int x, int y){
      if(x>y){
            return n;
      }
      int ans=0;
      for(int i=0; i<n; i++){
            if(A[i]<x){
                  ans++;
            }
      }
      return ans;
}

int main(){
      int n, x, y;
      cin >> n >> x >> y;
      vector<int> A;
      for(int i=0; i<n; i++){
            int temp;
            cin >> temp;
            A.push_back(temp);
      }
      cout << findZeros(A, n, x, y);
}


#include<iostream>
using namespace std;

int findZeros(vector<int> A, int n, int x, int y){
      if(x>y){
            return n;
      }
      int ans=0;
      for(int i=0; i<n; i++){
            if(A[i]<x){
                  ans++;
            }
      }
      return ans;
}

int main(){
      int n, x, y;
      cin >> n >> x >> y;
      vector<int> A;
      for(int i=0; i<n; i++){
            int temp;
            cin >> temp;
            A.push_back(temp);
      }
      cout << findZeros(A, n, x, y);
      return 0;
}


#include<bits/stdc++.h>
using namespace std;

int findZeros(vector<int> A, int n, int x, int y){
      if(x>y){
            return n;
      }
      int ans=0;
      for(int i=0; i<n; i++){
            if(A[i]<=x){
                  ans++;
            }
      }
      return (ans+1)/2;
}

int main(){
      int n, x, y;
      cin >> n >> x >> y;
      vector<int> A;
      for(int i=0; i<n; i++){
            int temp;
            cin >> temp;
            A.push_back(temp);
      }
      cout << findZeros(A, n, x, y);
      return 0;
}


#include<bits/stdc++.h>
using namespace std;

int findZeros(vector<int> A, int n, int x, int y){
      if(x>y){
            return n;
      }
      int ans=0;
      for(int i=0; i<n; i++){
            if(A[i]<x){
                  ans++;
            }
      }
      return ans;
}

int main(){
      int n, x, y;
      cin >> n >> x >> y;
      vector<int> A;
      for(int i=0; i<n; i++){
            int temp;
            cin >> temp;
            A.push_back(temp);
      }
      cout << findZeros(A, n, x, y);
      return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main()
{
    int n;
    long int x,y;
    cin>>n>>x>>y;

    vector<int>a(n);

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }

    sort(a.begin(),a.end());

    int count=0;
    if(x>y)
    {
        cout<<n<<endl;
        return 0;
    }

    while(a[i]<=x)
    {
        count++;
    }

    int c=count/2;
    cout<<count-c<<endl;

}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main()
{
    int n;
    long int x,y;
    cin>>n>>x>>y;

    vector<int>a(n);

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }

    int count=0;
    if(x>y)
    {
        cout<<n<<endl;
        return 0;
    }

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

    int c=count/2;
    cout<<count-c<<endl;

}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main()
{
    int n;
    long int x,y;
    cin>>n>>x>>y;

    vector<int>a(n);

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }

    int count=0;
    if(x>y)
    {
        cout<<n<<endl;
        return 0;
    }

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

    count=count/2;
    cout<<count<<endl;

}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main()
{
    int n;
    long int x,y;
    cin>>n>>x>>y;

    vector<int>a(n);

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }

    sort(a.begin(),a.end());

    int count=0;
    if(x>y)
    {
        cout<<n<<endl;
        return 0;
    }

    while(a[i]<=x)
    {
        count++;
    }

    count=count/2;
    cout<<count<<endl;

}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main()
{
    int n;
    long int x,y;
    cin>>n>>x>>y;

    vector<int>a(n);

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }

    sort(a.begin(),a.end());

    int count=0;
    if(x>y)
    {
        cout<<n<<endl;
        return 0;
    }
    int i=0;
    while(a[i]<=x)
    {
        count++;
    }

    count=count/2;
    cout<<count<<endl;

}


#include <stdio.h>
#include <set>

typedef std::multiset<int> mset;

void delobj(mset &a, int x){
	if(a.find(x) != a.end()) a.erase(a.find(x));
}

int main(void){

	int n, x, y, count = 0; scanf("%d %d %d", &n, &x, &y);
	mset a;
	for(int i=0; i<n; i++){
		int temp; scanf("%d", &temp);
		a.insert(temp);
	}

	// Game start
	int game = 0;
	while(!a.empty() && game < (1<<20)){
		game++;

		// My turn
		mset::iterator x_up = a.upper_bound(x);
		if(x_up == a.begin()){ // No one is killable
			int minimum = *(a.begin());
			delobj(a, minimum);
			a.insert(minimum-x);
			//printf("%d -> %d removed\n", minimum, minimum - x);
		}
		else{ // Immediate biggest deletion
			x_up--;
			int maximum = *x_up;
			delobj(a, maximum);
			count++;
			//printf("%d destroyed\n", maximum);
		}

		if(a.empty()) break;

		// Slavik's turn
		mset::iterator y_down = a.lower_bound(x-y), y_up = a.upper_bound(x);
		if(y_down == y_up){ // Immediate saveable not exist; Add minimum
			int minimum = *y_up;
			delobj(a, minimum);
			a.insert(minimum + y);
			//printf("%d -> %d added\n", minimum, minimum + y);
		}
		else{ // Immediate saveable exist; Save maximum one
			y_up--;
			int maximum = *y_up;
			delobj(a, maximum);
			a.insert(maximum + y);
			//printf("%d -> %d added\n", maximum, maximum + y);
		}
	}

	printf("%d", count);

	return 0;
}


#include <stdio.h>
#include <set>

typedef std::multiset<int> mset;

void delobj(mset &a, int x){
	if(a.find(x) != a.end()) a.erase(a.find(x));
}

int main(void){

	int n, x, y, count = 0; scanf("%d %d %d", &n, &x, &y);
	mset a;
	for(int i=0; i<n; i++){
		int temp; scanf("%d", &temp);
		a.insert(temp);
	}

	// Game start
	int game = 0;
	while(!a.empty() && game < (1<<22)){
		game++;

		// My turn
		mset::iterator x_up = a.upper_bound(x);
		if(x_up == a.begin()){ // No one is killable
			int minimum = *(a.begin());
			delobj(a, minimum);
			a.insert(minimum-x);
			//printf("%d -> %d removed\n", minimum, minimum - x);
		}
		else{ // Immediate biggest deletion
			x_up--;
			int maximum = *x_up;
			delobj(a, maximum);
			count++;
			//printf("%d destroyed\n", maximum);
		}

		if(a.empty()) break;

		// Slavik's turn
		mset::iterator y_down = a.lower_bound(x-y), y_up = a.upper_bound(x);
		if(y_down == y_up){ // Immediate saveable not exist; Add minimum
			int minimum = *y_up;
			delobj(a, minimum);
			a.insert(minimum + y);
			//printf("%d -> %d added\n", minimum, minimum + y);
		}
		else{ // Immediate saveable exist; Save maximum one
			y_up--;
			int maximum = *y_up;
			delobj(a, maximum);
			a.insert(maximum + y);
			//printf("%d -> %d added\n", maximum, maximum + y);
		}
	}

	printf("%d", count);

	return 0;
}


#include <stdio.h>
#include <set>

typedef std::multiset<int> mset;

void delobj(mset &a, int x){
	if(a.find(x) != a.end()) a.erase(a.find(x));
}

int main(void){

	int n, x, y, count = 0; scanf("%d %d %d", &n, &x, &y);
	mset a;
	for(int i=0; i<n; i++){
		int temp; scanf("%d", &temp);
		a.insert(temp);
	}

	if(x>y){
		printf("%d\n", n);
		return 0;
	}

	// Game start
	int game = 0;
	while(!a.empty() && game < (1<<22)){
		game++;

		// My turn
		mset::iterator x_up = a.upper_bound(x);
		if(x_up == a.begin()){ // No one is killable
			int minimum = *(a.begin());
			delobj(a, minimum);
			a.insert(minimum-x);
			//printf("%d -> %d removed\n", minimum, minimum - x);
		}
		else{ // Immediate biggest deletion
			x_up--;
			int maximum = *x_up;
			delobj(a, maximum);
			count++;
			//printf("%d destroyed\n", maximum);
		}

		if(a.empty()) break;

		// Slavik's turn
		mset::iterator y_down = a.lower_bound(x-y), y_up = a.upper_bound(x);
		if(y_down == y_up){ // Immediate saveable not exist; Add minimum
			int minimum = *y_up;
			delobj(a, minimum);
			a.insert(minimum + y);
			//printf("%d -> %d added\n", minimum, minimum + y);
		}
		else{ // Immediate saveable exist; Save maximum one
			y_up--;
			int maximum = *y_up;
			delobj(a, maximum);
			a.insert(maximum + y);
			//printf("%d -> %d added\n", maximum, maximum + y);
		}
	}

	printf("%d", count);

	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

int N, x, y, a, cur, i;
vector <int> v;
map <int, int> mp;
int main()
{
    cin >> N >> x >> y;
    for(int i = 0; i < N; ++i)
        cin >> a, v.push_back(a), mp[a]++;
    sort(v.begin(), v.end());
    if(x > y)
        return cout << N, 0;
    i = lower_bound(v.begin(), v.end(), x) - v.begin();
    a = (mp[v[i]] + 1) / 2, cur = mp[v[i]] % 2;
    while(i > -1)
    {
        if(v[i] == x)
        {
            --i;
            continue;
        }
        if(v[i] + cur * y <= x)
            ++a, ++cur;
        else
            cur -= (x - v[i] + y - 1) / y;
        --i;
    }
    cout << a;
}


#include <iostream>
using namespace std;

int N, x, y, a, C;
int main()
{
    cin >> N >> x >> y;
    for(int i = 0; i < N; ++i)
        cin >> a, C += (a <= x);
    sort(v.begin(), v.end());
    if(x > y)
        return cout << N, 0;
    cout << (C + 1) / 2;
}


#include <iostream>
using namespace std;

int N, x, y, a, C;
int main()
{
    cin >> N >> x >> y;
    for(int i = 0; i < N; ++i)
        cin >> a, C += (a <= x);
    if(x > y)
        return cout << N, 0;
    cout << (C + 1) / 2;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

int N, x, y, a, cur, i;
vector <int> v;
map <int, int> mp;
int main()
{
    cin >> N >> x >> y;
    for(int i = 0; i < N; ++i)
        cin >> a, v.push_back(a), mp[a]++;
    sort(v.begin(), v.end());
    if(x > y)
        return cout << N, 0;
    i = lower_bound(v.begin(), v.end(), x) - v.begin();
    a = 0;
    if(v[i] < x)
        a = (mp[v[i]] + 1) / 2, cur = mp[v[i]] % 2;
    while(i > -1)
    {
        if(v[i] == x)
        {
            --i;
            continue;
        }
        if(v[i] + cur * y <= x)
            ++a, ++cur;
        else
            cur -= (x - v[i] + y - 1) / y;
        --i;
    }
    cout << a;
}


#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
const ll SZ = 262144*2;
struct Segtree1 {

ll identity = 0;

ll sum[2*SZ], lazy[2*SZ];
ll combine(ll A, ll B) {
    return max(A, B);
}

ll combineUpd(ll A, ll B) {
    return A+B;
}

void push(int index, ll L, ll R) {
    sum[index] = combineUpd(sum[index], lazy[index]);
    if (L != R) lazy[2*index] = combineUpd(lazy[2*index], lazy[index]), lazy[2*index+1] = combineUpd(lazy[2*index+1], lazy[index]);
    lazy[index] = identity;
}

void pull(int index) {
    sum[index] = combine(sum[2*index], sum[2*index+1]);
}

ll query(int lo, int hi, int index = 1, ll L = 0, ll R = SZ-1) {
    push(index, L, R);
    if (lo > R || L > hi) return identity;
    if (lo <= L && R <= hi) return sum[index];

    int M = (L+R) / 2;
    return combine(query(lo, hi, 2*index, L, M), query(lo, hi, 2*index+1, M+1, R));
}

void update(int lo, int hi, ll increase, int index = 1, ll L = 0, ll R = SZ-1) {
    push(index, L, R);
    if (hi < L || R < lo) return;
    if (lo <= L && R <= hi) {
        lazy[index] = increase;
        push(index, L, R);
        return;
    }

    int M = (L+R) / 2;
    update(lo, hi, increase, 2*index, L, M); update(lo, hi, increase, 2*index+1, M+1, R);
    pull(index);
}
};

struct Segtree2 {

ll* seg = new ll[2*SZ]; //segtree implementation by bqi343's Github

ll combine(ll a, ll b) { return min(a, b); }

void build() { F0Rd(i,SZ) seg[i] = combine(seg[2*i],seg[2*i+1]); }

void update(int p, ll value) {
    for (seg[p += SZ] = value; p > 1; p >>= 1)
        seg[p>>1] = combine(seg[(p|1)^1], seg[p|1]);
}

ll query(int l, int r) {  // sum on interval [l, r]
    ll resL = 1000000, resR = 1000000; r++;
    for (l += SZ, r += SZ; l < r; l >>= 1, r >>= 1) {
        if (l&1) resL = combine(resL,seg[l++]);
        if (r&1) resR = combine(seg[--r],resR);
    }
    return combine(resL,resR);
}
};

Segtree1 seg1;
Segtree2 seg2;
int N;
int A[2*MX];

int L[2*MX], R[2*MX];

void add(int p) {
    seg1.update(L[p], R[p], 1);
}

void remove(int p) {
    seg1.update(L[p], R[p], -1);
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);

    F0R(i, 2*SZ) {
        seg1.sum[i] = 0;
        seg2.seg[i] = 1000000;
        seg1.lazy[i] = 0;
    }
    cin >> N;
    F0R(i, N) {
        cin >> A[i];
        seg2.update(i, A[i]);
        seg2.update(i+N, A[i]);
        A[i+N] = A[i];
    }
    F0R(i, 2*N) {
        int lo = 0, hi = i;
        while (lo < hi) {
            int mid = (lo+hi)/2;
            if (seg2.query(mid, i) == A[i]) {
                hi = mid;
            } else {
                lo = mid+1;
            }
        }
        L[i] = lo;
        lo = i;
        hi = 2*N;
        while (lo < hi) {
            int mid = (lo+hi+1)/2;
            if (seg2.query(i, mid) == A[i]) {
                lo = mid;
            } else {
                hi = mid-1;
            }
        }
        R[i] = lo;
    }
/*    F0R(i, 2*N) {
        cout << i << " " << L[i] << " " << R[i] << nl;
    }*/
    F0R(i, N) {
        add(i);
    }
    ll ans = seg1.query(0, N-1);
    int pos = 0;
    FOR(i, N, 2*N) {
        remove(i-N);
        add(i);
        if (ckmin(ans, seg1.query(i-N+1, i))) {
            pos = i-N+1;
        }
    }

    cout << ans << " " << pos << nl;

	return 0;
}

// read the question correctly (ll vs int)
// template by bqi343


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

#define cerr if (false) cerr

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> a(n);
    for (auto &t : a) {
        cin >> t;
    }
    for (int i = 0; i < n; i++) {
        a.push_back(a[i]);
    }
    vector<int> val(2 * n);
    vector<int> r(2 * n);
    vector<int> l(2 * n);
    {
        vector<int> st;
        for (int i = 0; i < 2 * n; i++) {
            while (!st.empty() && a[st.back()] >= a[i]) {
                st.pop_back();
            }
            if (!st.empty()) {
                l[i] = st.back();
            } else {
                l[i] = -1;
            }
            val[i] += (int)st.size();
            st.push_back(i);
        }
    }
    {
        vector<int> st;
        int cnt = 0;
        for (int i = 2 * n - 1; i >= 0; i--) {
            while (!st.empty() && a[st.back()] >= a[i]) {
                if (st.back() < n) {
                    cnt--;
                }
                st.pop_back();
            }
            if (!st.empty()) {
                r[i] = st.back();
            } else {
                r[i] = 2 * n;
            }
            val[i] += cnt;
            st.push_back(i);
            if (i < n) {
                cnt++;
            }
        }
    }
    {
        cerr << "val" << endl;
        for (auto t : val) {
            cerr << t << ' ';
        }
        cerr << endl;
    }
    int ans = n + 1;
    int s_ans = -1;
    for (int i = 0; i <= n; i++) {
        int cur = *max_element(val.begin() + i, val.begin() + i + n);
        if (cur < ans) {
            ans = cur;
            s_ans = i;
        }
        if (i < n) {
            cerr << i << endl;
            cerr << r[i] << ' ' << l[i + n] << endl;
            for (auto t : val) {
                cerr << t << ' ';
            }
            cerr << endl;
            for (int j = i + 1; j < min(r[i], i + n); j++) {
                val[j]--;
            }
            for (auto t : val) {
                cerr << t << ' ';
            }
            cerr << endl;
            for (int j = i + n - 1; j > max(i, l[i + n]); j--) {
                val[j]++;
            }
            for (auto t : val) {
                cerr << t << ' ';
            }
            cerr << endl << endl;
        }

    }
    cout << ans + 1 << ' ' << s_ans << endl;
    // cout << l[5] << endl;
    // cout << a[4] << ' ' << a[5] << endl;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

#define cerr if (false) cerr

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> a(n);
    for (auto &t : a) {
        cin >> t;
    }
    for (int i = 0; i < n; i++) {
        a.push_back(a[i]);
    }
    vector<int> val(2 * n);
    vector<int> r(2 * n);
    vector<int> l(2 * n);
    {
        vector<int> st;
        for (int i = 0; i < 2 * n; i++) {
            while (!st.empty() && a[st.back()] >= a[i]) {
                st.pop_back();
            }
            if (!st.empty()) {
                l[i] = st.back();
            } else {
                l[i] = -1;
            }
            val[i] += (int)st.size();
            st.push_back(i);
        }
    }
    {
        vector<int> st;
        for (int i = 2 * n - 1; i >= 0; i--) {
            while (!st.empty() && a[st.back()] >= a[i]) {
                st.pop_back();
            }
            if (!st.empty()) {
                r[i] = st.back();
            } else {
                r[i] = 2 * n;
            }
            // if (i < n) {
            //     val[i] += (int)st.size();
            // }
            st.push_back(i);
        }
    }
    {
        cerr << "val" << endl;
        for (auto t : val) {
            cerr << t << ' ';
        }
        cerr << endl;
    }
    int ans = n + 1;
    int s_ans = -1;
    for (int i = 0; i <= n; i++) {
        int cur = *max_element(val.begin() + i, val.begin() + i + n);
        if (cur < ans) {
            ans = cur;
            s_ans = i;
        }
        if (i < n) {
            cerr << i << endl;
            cerr << r[i] << ' ' << l[i + n] << endl;
            for (auto t : val) {
                cerr << t << ' ';
            }
            cerr << endl;
            for (int j = i + 1; j < min(r[i], i + n); j++) {
                val[j]--;
            }
            for (auto t : val) {
                cerr << t << ' ';
            }
            cerr << endl;
            for (int j = i + n - 1; j > max(i, l[i + n]); j--) {
                val[j]++;
            }
            for (auto t : val) {
                cerr << t << ' ';
            }
            cerr << endl << endl;
        }

    }
    cout << ans + 1 << ' ' << s_ans << endl;
    // cout << l[5] << endl;
    // cout << a[4] << ' ' << a[5] << endl;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

#define cerr if (false) cerr

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> a(n);
    for (auto &t : a) {
        cin >> t;
    }
    for (int i = 0; i < n; i++) {
        a.push_back(a[i]);
    }
    vector<int> val(2 * n);
    vector<int> r(2 * n);
    vector<int> l(2 * n);
    {
        vector<int> st;
        for (int i = 0; i < 2 * n; i++) {
            while (!st.empty() && a[st.back()] >= a[i]) {
                st.pop_back();
            }
            if (!st.empty()) {
                l[i] = st.back();
            } else {
                l[i] = -1;
            }
            val[i] += (int)st.size();
            st.push_back(i);
        }
    }
    {
        vector<int> st;
        for (int i = 2 * n - 1; i >= 0; i--) {
            while (!st.empty() && a[st.back()] >= a[i]) {
                st.pop_back();
            }
            if (!st.empty()) {
                r[i] = st.back();
            } else {
                r[i] = 2 * n;
            }
            if (i < n) {
                for (auto t : st) {
                    if (t < n) {
                        val[i]++;
                    }
                }
            }
            st.push_back(i);
        }
    }
    {
        cerr << "val" << endl;
        for (auto t : val) {
            cerr << t << ' ';
        }
        cerr << endl;
    }
    int ans = n + 1;
    int s_ans = -1;
    for (int i = 0; i <= n; i++) {
        int cur = *max_element(val.begin() + i, val.begin() + i + n);
        if (cur < ans) {
            ans = cur;
            s_ans = i;
        }
        if (i < n) {
            cerr << i << endl;
            cerr << r[i] << ' ' << l[i + n] << endl;
            for (auto t : val) {
                cerr << t << ' ';
            }
            cerr << endl;
            for (int j = i + 1; j < min(r[i], i + n); j++) {
                val[j]--;
            }
            for (auto t : val) {
                cerr << t << ' ';
            }
            cerr << endl;
            for (int j = i + n - 1; j > max(i, l[i + n]); j--) {
                val[j]++;
            }
            for (auto t : val) {
                cerr << t << ' ';
            }
            cerr << endl << endl;
        }

    }
    cout << ans + 1 << ' ' << s_ans << endl;
    // cout << l[5] << endl;
    // cout << a[4] << ' ' << a[5] << endl;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

#define cerr if (false) cerr

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> a(n);
    for (auto &t : a) {
        cin >> t;
    }
    for (int i = 0; i < n; i++) {
        a.push_back(a[i]);
    }
    vector<int> val(2 * n);
    vector<int> r(2 * n);
    vector<int> l(2 * n);
    {
        vector<int> st;
        for (int i = 0; i < 2 * n; i++) {
            while (!st.empty() && a[st.back()] >= a[i]) {
                st.pop_back();
            }
            if (!st.empty()) {
                l[i] = st.back();
            } else {
                l[i] = -1;
            }
            val[i] += (int)st.size();
            st.push_back(i);
        }
    }
    {
        vector<int> st;
        int cnt = 0;
        for (int i = 2 * n - 1; i >= 0; i--) {
            while (!st.empty() && a[st.back()] >= a[i]) {
                if (st.back() < n) {
                    cnt--;
                }
                st.pop_back();
            }
            if (!st.empty()) {
                r[i] = st.back();
            } else {
                r[i] = 2 * n;
            }
            val[i] += cnt;
            st.push_back(i);
            if (i < n) {
                cnt++;
            }
        }
    }
    int ans = n + 1;
    int s_ans = -1;
    for (int i = 0; i <= n; i++) {
        int cur = *max_element(val.begin() + i, val.begin() + i + n);
        if (cur < ans) {
            ans = cur;
            s_ans = i;
        }
        if (i < n) {
            for (int j = i + 1; j < min(r[i], i + n); j++) {
                val[j]--;
            }
            for (int j = i + n - 1; j > max(i, l[i + n]); j--) {
                val[j]++;
            }
        }

    }
    cout << ans + 1 << ' ' << s_ans << endl;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

#define cerr if (false) cerr

namespace SegmentTree {
    int n;
    vector<int> t;
    vector<int> mod;

    void apply(int v, int val) {
        t[v] += val;
        mod[v] += val;
    }

    void push(int v) {
        if (mod[v] != 0) {
            apply(2 * v + 1, mod[v]);
            apply(2 * v + 2, mod[v]);
            mod[v] = 0;
        }
    }

    void pull(int v) {
        t[v] = max(t[2 * v + 1], t[2 * v + 2]);
    }

    void build(int v, int l, int r, vector<int> &a) {
        if (l + 1 == r) {
            t[v] = a[l];
        } else {
            int m = (r + l) >> 1;
            build(2 * v + 1, l, m, a);
            build(2 * v + 2, m, r, a);
            pull(v);
        }
    }

    void add(int v, int l, int r, int ql, int qr, int val) {
        if (r <= ql || qr <= l) {
            return;
        } else if (ql <= l && r <= qr) {
            apply(v, val);
        } else {
            push(v);
            int m = (r + l) >> 1;
            add(2 * v + 1, l, m, ql, qr, val);
            add(2 * v + 2, m, r, ql, qr, val);
            pull(v);
        }
    }

    int query(int v, int l, int r, int ql, int qr) {
        if (r <= ql || qr <= l) {
            return 0;
        } else if (ql <= l && r <= qr) {
            return t[v];
        } else {
            push(v);
            int m = (r + l) >> 1;
            int f = query(2 * v + 1, l, m, ql, qr);
            int s = query(2 * v + 2, m, r, ql, qr);
            pull(v);
            return max(f, s);
        }
    }

    void build(vector<int> &a) {
        n = (int)a.size();
        t.resize(4 * n);
        mod.resize(4 * n);
        build(0, 0, n, a);
    }

    void add(int l, int r, int val) {
        add(0, 0, n, l, r, val);
    }

    int query(int l, int r) {
        return query(0, 0, n, l, r);
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> a(n);
    for (auto &t : a) {
        cin >> t;
    }
    for (int i = 0; i < n; i++) {
        a.push_back(a[i]);
    }
    vector<int> val(2 * n);
    vector<int> r(2 * n);
    vector<int> l(2 * n);
    {
        vector<int> st;
        for (int i = 0; i < 2 * n; i++) {
            while (!st.empty() && a[st.back()] >= a[i]) {
                st.pop_back();
            }
            if (!st.empty()) {
                l[i] = st.back();
            } else {
                l[i] = -1;
            }
            val[i] += (int)st.size();
            st.push_back(i);
        }
    }
    {
        vector<int> st;
        int cnt = 0;
        for (int i = 2 * n - 1; i >= 0; i--) {
            while (!st.empty() && a[st.back()] >= a[i]) {
                if (st.back() < n) {
                    cnt--;
                }
                st.pop_back();
            }
            if (!st.empty()) {
                r[i] = st.back();
            } else {
                r[i] = 2 * n;
            }
            val[i] += cnt;
            st.push_back(i);
            if (i < n) {
                cnt++;
            }
        }
    }
    SegmentTree::build(val);
    int ans = n + 1;
    int s_ans = -1;
    for (int i = 0; i <= n; i++) {
        int cur = SegmentTree::query(i, i + n);
        if (cur < ans) {
            ans = cur;
            s_ans = i;
        }
        if (i < n) {
            SegmentTree::add(i + 1, min(r[i], i + n), -1);
            SegmentTree::add(max(i, l[i + n]) + 1, i + n, 1);
        }
    }
    cout << ans + 1 << ' ' << s_ans << endl;
}


#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n;
const int maxN = 4 * (int)1e5 + 100;
int a[maxN];
const int LG = 20;
pair < int, int > up[maxN][LG];
int lg[maxN];
map < pair < int, int >, int > mp;
int getMin(int l, int r) {
    int k = lg[r - l + 1];
    return min(up[l][k], up[r - (1 << k) + 1][k]).second;
}
int solve(int l, int r) {
    if (r < l) return 0;
    if (mp.count({l, r})) return mp[{l, r}];
    auto it = getMin(l, r);
    return mp[{l, r}] = 1 + max(solve(l, it - 1), solve(it + 1, r));
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    lg[1] = 0;
    for (int i = 2; i < maxN; i++) {
        lg[i] = lg[i - 1];
        if (!(i & (i - 1))) lg[i]++;
    }
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        a[i + n] = a[i];
    }
    n *= 2;
    for (int i = 1; i <= n; i++) {
        up[i][0] = make_pair(a[i], i);
    }
    for (int j = 0; j + 1 < LG; j++) {
        for (int i = 1; i + (1 << (j + 1)) - 1 <= n; i++) {
            up[i][j + 1] = min(up[i][j], up[i + (1 << j)][j]);
        }
    }
    pair < int, int > best = make_pair(n + 100, -1);
    for (int i = 1; i <= n / 2; i++) {
        best = min(best, make_pair(solve(i, i + n / 2 - 1), i - 1));
    }
    cout << best.first << " " << best.second << '\n';
    return 0;
}


#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n;
const int maxN = 4 * (int)1e5 + 100;
int a[maxN];
const int LG = 20;
pair < int, int > up[maxN][LG];
int lg[maxN];
unordered_map < int, int > mp[maxN];
int getMin(int l, int r) {
    int k = lg[r - l + 1];
    return min(up[l][k], up[r - (1 << k) + 1][k]).second;
}
int solve(int l, int r) {
    if (l >= n / 2 + 1 && r >= n / 2 + 1) return solve(l - n / 2, r - n / 2);
    if (r < l) return 0;
    if (mp[l].count(r)) return mp[l][r];
    auto it = getMin(l, r);
    return mp[l][r] = 1 + max(solve(l, it - 1), solve(it + 1, r));
}
mt19937 rnd(228);
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    lg[1] = 0;
    for (int i = 2; i < maxN; i++) {
        lg[i] = lg[i - 1];
        if (!(i & (i - 1))) lg[i]++;
    }
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        a[i + n] = a[i];
    }
    n *= 2;
    for (int i = 1; i <= n; i++) {
        up[i][0] = make_pair(a[i], i);
    }
    for (int j = 0; j + 1 < LG; j++) {
        for (int i = 1; i + (1 << (j + 1)) - 1 <= n; i++) {
            up[i][j + 1] = min(up[i][j], up[i + (1 << j)][j]);
        }
    }
    pair < int, int > best = make_pair(n + 100, -1);
    for (int i = 1; i <= n / 2; i++) {
        best = min(best, make_pair(solve(i, i + n / 2 - 1), i - 1));
    }
    cout << best.first << " " << best.second << '\n';
    return 0;
}


#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n;
const int maxN = 4 * (int)1e5 + 100;
int a[maxN];
mt19937 rnd(228);
int t[4 * maxN];
void build(int v, int tl, int tr) {
    if (tl == tr) {
        t[v] = a[tl];
        return;
    }
    int tm = (tl + tr) / 2;
    build(2 * v, tl, tm);
    build(2 * v + 1, tm + 1, tr);
    t[v] = min(t[2 * v], t[2 * v + 1]);
}
int find(int v, int tl, int tr, int l, int r, int val, bool left) {
    if (r < 1) return -1;
    if (l > r) return -1;
    if (t[v] > val) return -1;
    if (tl == tr) {
        return tl;
    }
    int tm = (tl + tr) / 2;
    if (left) {
        int p = find(2 * v, tl, tm, l, min(r, tm), val, left);
        if (p != -1) return p;
        return find(2 * v + 1, tm + 1, tr, max(tm + 1, l), r, val, left);
    }
    else {
        int p = find(2 * v + 1, tm + 1, tr, max(tm + 1, l), r, val, left);
        if (p != -1) return p;
        return find(2 * v, tl, tm, l, min(r, tm), val, left);
    }
}

pair < ll, int > tt[4 * maxN];
ll upd[4 * maxN];
void build2(int v, int tl, int tr) {
    tt[v] = make_pair(0, tl);
    if (tl == tr) return;
    int tm = (tl + tr) / 2;
    build2(2 * v, tl, tm);
    build2(2 * v + 1, tm + 1, tr);
}
void push(int v, int tl, int tr) {
    if (upd[v] == 0) return;
    tt[v].first += upd[v];
    if (tl != tr) {
        upd[2 * v] += upd[v];
        upd[2 * v + 1] += upd[v];
    }
    upd[v] = 0;
}
void add(int v, int tl, int tr, int l, int r, int val) {
    if (l > r) return;
    if (l <= tl && tr <= r) {
        upd[v] += val;
        push(v, tl, tr);
        return;
    }
    push(v, tl, tr);
    if (r < tl || l > tr) return;
    int tm = (tl + tr) / 2;
    add(2 * v, tl, tm, l, r, val);
    add(2 * v + 1, tm + 1, tr, l, r, val);
    tt[v] = max(tt[2 * v], tt[2 * v + 1]);
}
const ll INF = 2e9;
pair < int, int > get_mx(int v, int tl, int tr, int l, int r) {
    push(v, tl, tr);
    if (l <= tl && tr <= r) return tt[v];
    if (l > r) return make_pair(-INF, -1);
    int tm = (tl + tr) / 2;
    return max(get_mx(2 * v, tl, tm, l, min(r, tm)), get_mx(2 * v + 1, tm + 1, tr, max(l, tm + 1), r));
}
void add(int l, int r, int pos) {
    int where = find(1, 1, n, l, r, a[pos], false);
    if (where == -1) {
        add(1, 1, n, l, r, 1);
        add(1, 1, n, r + 1, r + 1, 1);
    }
    else {
        auto it = get_mx(1, 1, n, where, where);
        add(1, 1, n, where + 1, r, 1);
        add(1, 1, n, r + 1, r + 1, it.first + 1);
    }
}
void del(int l, int r, int pos) {
    int where = find(1, 1, n, l + 1, r, a[pos], true);
    if (where == -1) {
        add(1, 1, n, l + 1, r, -1);
    }
    else {
        add(1, 1, n, l + 1, where - 1, -1);
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        a[i + n] = a[i];
    }
    n *= 2;
    build(1, 1, n);
    build2(1, 1, n);
    for (int i = 1; i <= n / 2; i++) {
        add(1, i - 1, i);
    }
    pair < int, int > best = make_pair(get_mx(1, 1, n, 1, n / 2).first, 0);
    for (int i = n / 2 + 1; i < n; i++) {
        del(i - n / 2, i - 1, i - n / 2);
        add(i - n / 2 + 1, i - 1, i);
        best = min(best, make_pair(get_mx(1, 1, n, i - n / 2 + 1, i).first, i - n / 2));
    }
    cout << best.first << " " << best.second << '\n';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int maxn=2e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define y1 abcdefg
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int n;
int a[maxn];
int seg[maxn],tag[maxn];
int L[maxn],R[maxn],P[maxn];
vector<int> v,u;

void push(int now,int l,int r)
{
    if (l==r)
    {
        tag[now]=0;
        return;
    }
    seg[now*2]+=tag[now];
    seg[now*2+1]+=tag[now];
    tag[now*2]+=tag[now];
    tag[now*2+1]+=tag[now];
    tag[now]=0;
}

void modify(int now,int l,int r,int ql,int qr,int v)
{
    if (r<ql||l>qr) return;
    else if (l>=ql&&r<=qr)
    {
        seg[now]+=v;
        tag[now]+=v;
        return;
    }
    int m=(l+r)>>1;
    push(now,l,r);
    modify(now*2,l,m,ql,qr,v);
    modify(now*2+1,m+1,r,ql,qr,v);
    seg[now]=max(seg[now*2],seg[now*2+1]);
}

int query(int now,int l,int r,int ql,int qr)
{
    if (r<ql||l>qr) return -inf;
    else if (l>=ql&&r<=qr) return seg[now];
    int m=(l+r)>>1;
    push(now,l,r);
    return max(query(now*2,l,m,ql,qr),query(now*2+1,m+1,r,ql,qr));
}

int32_t main()
{
    IOS
    cin>>n;
    for (int i=1;i<=n;i++) cin>>a[i];

    a[0]=a[n+1]=-1;
    v.pb(0);
    for (int i=1;i<=n;i++)
    {
        while (a[v.back()]>a[i]) v.pop_back();
        if (v.back()+1!=i) modify(1,1,2*n,v.back()+1,i-1,1);
        v.pb(i);
    }
    v.clear();
    v.pb(n+1);
    for (int i=n;i>=1;i--)
    {
        while (a[v.back()]>a[i]) v.pop_back();
        if (v.back()-1!=i) modify(1,1,2*n,i+1,v.back()-1,1);
        v.pb(i);
    }

    a[0]=a[2*n+1]=-1;
    for (int i=1;i<=n;i++) a[i+n]=a[i];
    v.clear();
    v.pb(0),u.pb(0);
    for (int i=1;i<=2*n;i++)
    {
        while (a[v.back()]>a[i]) v.pop_back();
        while (a[u.back()]>=a[i]) u.pop_back();
        if (i>n)
        {
             L[i-n]=v.back()+1;
             P[i-n]=sz(u)-1;
        }
        v.pb(i);
        u.pb(i);
    }
    v.clear();
    v.pb(2*n+1);
    for (int i=2*n;i>=1;i--)
    {
        while (a[v.back()]>a[i]) v.pop_back();
        if (i<=n) R[i]=v.back()-1;
        v.pb(i);
    }

    pii ans=mkp(query(1,1,2*n,1,n),0);
    for (int i=1;i<=n-1;i++)
    {
        modify(1,1,2*n,i,R[i],-1);
        modify(1,1,2*n,L[i],n+i,1);
        modify(1,1,2*n,n+i,n+i,-query(1,1,2*n,n+i,n+i)+P[i]);
        ans=min(ans,mkp(query(1,1,2*n,i+1,n+i),i));
    }
    cout<<ans.F+1<<' '<<ans.S<<endl;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define y1 abcdefg
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int n;
int a[maxn];
int seg[maxn],seg2[maxn],tag[maxn];
int L[maxn],R[maxn];
vector<int> v;

void push(int now,int l,int r)
{
    if (l==r)
    {
        tag[now]=0;
        return;
    }
    seg[now*2]+=tag[now];
    seg[now*2+1]+=tag[now];
    seg2[now*2]+=tag[now];
    seg2[now*2+1]+=tag[now];
    tag[now*2]+=tag[now];
    tag[now*2+1]+=tag[now];
    tag[now]=0;
}

void modify(int now,int l,int r,int ql,int qr,int v)
{
    if (r<ql||l>qr) return;
    else if (l>=ql&&r<=qr)
    {
        seg[now]+=v;
        seg2[now]+=v;
        tag[now]+=v;
        return;
    }
    int m=(l+r)>>1;
    push(now,l,r);
    modify(now*2,l,m,ql,qr,v);
    modify(now*2+1,m+1,r,ql,qr,v);
    seg[now]=max(seg[now*2],seg[now*2+1]);
    seg2[now]=min(seg[now*2],seg[now*2+1]);
}

int query(int now,int l,int r,int ql,int qr)
{
    if (r<ql||l>qr) return -inf;
    else if (l>=ql&&r<=qr) return seg[now];
    int m=(l+r)>>1;
    push(now,l,r);
    return max(query(now*2,l,m,ql,qr),query(now*2+1,m+1,r,ql,qr));
}

int query2(int now,int l,int r,int ql,int qr)
{
    if (r<ql||l>qr) return inf;
    else if (l>=ql&&r<=qr) return seg2[now];
    int m=(l+r)>>1;
    push(now,l,r);
    return min(query(now*2,l,m,ql,qr),query(now*2+1,m+1,r,ql,qr));
}

int32_t main()
{
    IOS
    cin>>n;
    for (int i=1;i<=n;i++) cin>>a[i];

    a[0]=a[n+1]=-1;
    v.pb(0);
    for (int i=1;i<=n;i++)
    {
        while (a[v.back()]>a[i]) v.pop_back();
        modify(1,1,n,v.back()+1,i,1);
        v.pb(i);
    }
    v.clear();
    v.pb(n+1);
    for (int i=n;i>=1;i--)
    {
        while (a[v.back()]>a[i]) v.pop_back();
        modify(1,1,n,i,v.back()-1,1);
        v.pb(i);
    }

    a[0]=a[2*n+1]=-1;
    for (int i=1;i<=n;i++) a[i+n]=a[i];
    v.clear();
    v.pb(0);
    for (int i=1;i<=2*n;i++)
    {
        while (a[v.back()]>a[i]) v.pop_back();
        if (i>n) L[i-n]=v.back()+1;
        v.pb(i);
    }
    v.clear();
    v.pb(2*n+1);
    for (int i=2*n;i>=1;i--)
    {
        while (a[v.back()]>a[i]) v.pop_back();
        if (i<=n) R[i]=v.back()-1;
        v.pb(i);
    }

    pii ans=mkp(query(1,1,n,1,n),0);
    for (int i=1;i<=n-1;i++)
    {
        if (R[i]>n)
        {
            modify(1,1,n,i,n,-1);
            modify(1,1,n,1,R[i]-n,-1);
        }
        else
        {
            modify(1,1,n,1,R[i],-1);
        }
        modify(1,1,n,i,i,300000);

        int now_min;
        if (L[i]==(i==1 ? n : i-1+n)) now_min=query(1,1,n,(i==1 ? n : i-1),(i==1 ? n : i-1))+1;
        else if (L[i]<=n) now_min=min(query2(1,1,n,L[i]-n,n),query2(1,1,n,1,i));
        else now_min=query2(1,1,n,L[i]-n,i);

        if (L[i]<=n)
        {
            modify(1,1,n,L[i]-n,n,1);
            modify(1,1,n,1,i,1);
        }
        else
        {
            modify(1,1,n,L[i]-n,i,1);
        }
        modify(1,1,n,i,i,-query(1,1,n,i,i)+now_min);
        ans=min(ans,mkp(query(1,1,n,1,n),i));
    }
    cout<<ans.F<<' '<<ans.S<<endl;
}


#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 18;
const int L = 22;
int A[N], Log[N], n, p;
pair<int, int> M[L][N];
int Min(int l, int r) {
	int x = Log[r - l];
	return min(M[x][l], M[x][r - (1 << x)]).second;
}
int Solve(int l, int r) {
	if (l == r)
		return 0;
	if (l + 1 == r)
		return 1;
	int pos = Min(l, r);
	return max(Solve(l, pos), Solve(pos + 1, r)) + 1;
}
int main () {
	for (int i = 2; i < N; i ++)
		Log[i] = Log[i >> 1] + 1;
	scanf("%d", &n);
	if (n == 1)
		return !puts("1");
	for (int i = 0; i < n; p = (A[i] ^ 1 ? p : i), i ++)
		scanf("%d", &A[i]);
	rotate(A, A + p, A + n);
	for (int i = 0; i < n; i ++)
		M[0][i] = {A[i], i};
	for (int i = 1; i < L; i ++)
		for (int j = 0; j + (1 << i) < N; j ++)
			M[i][j] = min(M[i - 1][j], M[i - 1][j + (1 << (i - 1))]);
	int L = 0, H = n;
	while (H - L > 1)
		Solve(1, (H + L) >> 1) <= Solve((H + L) >> 1, n) ? L = (H + L) >> 1 : H = (H + L) >> 1;
	int l = max(Solve(1, L), Solve(L, n)), r = max(Solve(1, H), Solve(H, n));
	printf("%d ", min(l, r) + 1);
	printf("%d", (l <= r ? (p + L) % n: (p + H) % n));
}


#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 18;
const int L = 22;
int A[N], Log[N], n, p;
pair<int, int> M[L][N];
int Min(int l, int r) {
	int x = Log[r - l];
	return min(M[x][l], M[x][r - (1 << x)]).second;
}
int Solve(int l, int r) {
	if (l == r)
		return 0;
	if (l + 1 == r)
		return 1;
	int pos = Min(l, r);
	return max(Solve(l, pos), Solve(pos + 1, r)) + 1;
}
int main () {
	for (int i = 2; i < N; i ++)
		Log[i] = Log[i >> 1] + 1;
	scanf("%d", &n);
	for (int i = 0; i < n; p = (A[i] ^ 1 ? p : i), i ++)
		scanf("%d", &A[i]);
	rotate(A, A + p, A + n);
	for (int i = 0; i < n; i ++)
		M[0][i] = {A[i], i};
	for (int i = 1; i < L; i ++)
		for (int j = 0; j + (1 << i) < N; j ++)
			M[i][j] = min(M[i - 1][j], M[i - 1][j + (1 << (i - 1))]);
	int L = 0, H = n;
	while (H - L > 1)
		Solve(1, (H + L) >> 1) <= Solve((H + L) >> 1, n) ? L = (H + L) >> 1 : H = (H + L) >> 1;
	int l = max(Solve(1, L), Solve(L, n)), r = max(Solve(1, H), Solve(H, n));
	printf("%d ", min(l, r) + 1);
	printf("%d", (l <= r ? (p + L) % n: (p + H) % n));
}


#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 18;
const int L = 22;
int A[N], Log[N], n, p;
pair<int, int> M[L][N];
int Min(int l, int r) {
	int x = Log[r - l];
	return min(M[x][l], M[x][r - (1 << x)]).second;
}
int Solve(int l, int r) {
	if (l == r)
		return 0;
	if (l + 1 == r)
		return 1;
	int pos = Min(l, r);
	return max(Solve(l, pos), Solve(pos + 1, r)) + 1;
}
int main () {
	for (int i = 2; i < N; i ++)
		Log[i] = Log[i >> 1] + 1;
	scanf("%d", &n);
	if (n == 1)
		{puts("1 0"); exit(0);};
	for (int i = 0; i < n; p = (A[i] ^ 1 ? p : i), i ++)
		scanf("%d", &A[i]);
	rotate(A, A + p, A + n);
	for (int i = 0; i < n; i ++)
		M[0][i] = {A[i], i};
	for (int i = 1; i < L; i ++)
		for (int j = 0; j + (1 << i) < N; j ++)
			M[i][j] = min(M[i - 1][j], M[i - 1][j + (1 << (i - 1))]);
	int L = 0, H = n;
	while (H - L > 1)
		Solve(1, (H + L) >> 1) <= Solve((H + L) >> 1, n) ? L = (H + L) >> 1 : H = (H + L) >> 1;
	int l = max(Solve(1, L), Solve(L, n)), r = max(Solve(1, H), Solve(H, n));
	printf("%d ", min(l, r) + 1);
	printf("%d", (l <= r ? (p + L) % n: (p + H) % n));
}


/// RESTRICTED AREA
// BEWARE
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("Os")

/*				Who knew evil girls had the prettiest face					*/

/*				I'm like "Hey, what's up? Hello"
				Seen yo pretty ass soon as you came in the door
				I just wanna chill, got a sack for us to roll
				Married to the money, introduced her to my stove
				Showed her how to whip it, now she remixin' for low
				She my trap queen, let her hit the bando
				We be countin' up, watch how far them bands go
				We just set a goal, talkin' matchin' Lambos
				At fifity six a gram, five a hundred grams though
				Man, I swear I love her, how she work the damn pole
				Hit the strip club, we be lettin' bands go
				Everybody hatin', we just call them fans, though
				In love with the money, I ain't never lettin' go			*/

/*				We pop out at your party, I'm with the gang
				And it's gon' be a robbery, so tuck ya chain
				I'm a killer girl, I'm sorry, but I cannot change
				We ain't aiming for your body, shots hit you brain
				We come from poverty, man, we ain't have a thing
				It's a lot of animosity, but they won't say my name
				Them killers rock with me, lil' nigga, don't get banged
				'Cause they'll do that job for me while I hop on a plane	*/

/*				I take you to the candy shop								*/

/*				Baby, let me put your panties to the side
				I'ma make you feel alright
				'Cause I'ma give you what you need, yeah					*/

/*				Ooooh ooh, it's me, myself and I
				Solo ride until I die, 'cause I got me for life				*/

/*				So I ball So hard, muh'fuckas wanna find me					*/

/*				Bitch, where you when I was walkin'?
				Now I run the game, got the whole world talkin'				*/

/*				Niggas been counting me out
				I'm counting my bullets, I'm loading my clips
				I'm writing down names, I'm making a list					*/

/*				Fuck your friendship, I meant it							*/

/*				The Chanel or Balenciaga, Louis and Vuitton
				She know I got Fendi, Prada when I hit Milan				*/

/*				I ran away, I don't think I'm coming back home				*/

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()

typedef int ll;
typedef long double ld;
typedef pair<ll,ll> pll;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=2e5+10, maxm=1e3+10, lg=21, mod=1e9+7, inf=1e18;

#define lc (v<<1)
#define rc (lc^1)

ll n,s,b[maxn],a[maxn];
ll dp[maxn],pd[maxn];

ll mx[maxn<<2],laz[maxn<<2];
void add(ll l,ll r,ll x,ll s=0,ll t=n,ll v=1){
	if(l>=t || r<=s) return;
	if(l<=s && r>=t){
		mx[v]+=x;
		laz[v]+=x;
		return;
	}
	ll mid=(s+t)>>1;
	add(l,r,x,s,mid,lc);
	add(l,r,x,mid,t,rc);
	mx[v]=max(mx[lc],mx[rc])+laz[v];
}
ll get(ll x,ll s=0,ll t=n,ll v=1){
	if(t-s==1) return mx[v];
	ll mid=(s+t)>>1;
	if(x<mid) return get(x,s,mid,lc)+laz[v];
	else      return get(x,mid,t,rc)+laz[v];
}

void guzman(ll *xx){
	memset(mx,0,sizeof(mx)), memset(laz,0,sizeof(laz));
	vector<ll> v; v.pb(1);
	for(int i=1;i<n;i++){
		while(v.back()>a[i]) v.pop_back();
		add(i,i+1,get(v.back())+1);
		add(v.back()+1,i,1);
		xx[i]=mx[1];
		//cout<<i<<' '<<a[i]<<' '<<xx[i]<<endl;
	}
}

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	cin>>n;
	for(int i=0;i<n;i++){
		cin>>b[i];
		if(b[i]==1) s=i;
	}
	for(int i=1;i<n;i++) a[i]=b[(s+i)%n];
	guzman(dp), reverse(a+1,a+n), guzman(pd);
	pll ans={mod,mod}; for(int ii=s,i=0;i<n;i++,ii--,ii+=n,ii%=n) ans=min(ans,{1+max(dp[n-1-ii],pd[ii]),i});
	cout<<ans.F<<' '<<ans.S;

	return 0;
}


/// RESTRICTED AREA
// BEWARE
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("Os")

/*				Who knew evil girls had the prettiest face					*/

/*				I'm like "Hey, what's up? Hello"
				Seen yo pretty ass soon as you came in the door
				I just wanna chill, got a sack for us to roll
				Married to the money, introduced her to my stove
				Showed her how to whip it, now she remixin' for low
				She my trap queen, let her hit the bando
				We be countin' up, watch how far them bands go
				We just set a goal, talkin' matchin' Lambos
				At fifity six a gram, five a hundred grams though
				Man, I swear I love her, how she work the damn pole
				Hit the strip club, we be lettin' bands go
				Everybody hatin', we just call them fans, though
				In love with the money, I ain't never lettin' go			*/

/*				We pop out at your party, I'm with the gang
				And it's gon' be a robbery, so tuck ya chain
				I'm a killer girl, I'm sorry, but I cannot change
				We ain't aiming for your body, shots hit you brain
				We come from poverty, man, we ain't have a thing
				It's a lot of animosity, but they won't say my name
				Them killers rock with me, lil' nigga, don't get banged
				'Cause they'll do that job for me while I hop on a plane	*/

/*				I take you to the candy shop								*/

/*				Baby, let me put your panties to the side
				I'ma make you feel alright
				'Cause I'ma give you what you need, yeah					*/

/*				Ooooh ooh, it's me, myself and I
				Solo ride until I die, 'cause I got me for life				*/

/*				So I ball So hard, muh'fuckas wanna find me					*/

/*				Bitch, where you when I was walkin'?
				Now I run the game, got the whole world talkin'				*/

/*				Niggas been counting me out
				I'm counting my bullets, I'm loading my clips
				I'm writing down names, I'm making a list					*/

/*				Fuck your friendship, I meant it							*/

/*				The Chanel or Balenciaga, Louis and Vuitton
				She know I got Fendi, Prada when I hit Milan				*/

/*				I ran away, I don't think I'm coming back home				*/

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()

typedef int ll;
typedef long double ld;
typedef pair<ll,ll> pll;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=2e5+10, maxm=1e3+10, lg=21, mod=1e9+7, inf=1e18;

#define lc (v<<1)
#define rc (lc^1)

ll n,s,b[maxn],a[maxn];
ll dp[maxn],pd[maxn];

ll mx[maxn<<2],laz[maxn<<2];
void add(ll l,ll r,ll x,ll s=0,ll t=n,ll v=1){
	if(l>=t || r<=s) return;
	if(l<=s && r>=t){
		mx[v]+=x;
		laz[v]+=x;
		return;
	}
	ll mid=(s+t)>>1;
	add(l,r,x,s,mid,lc);
	add(l,r,x,mid,t,rc);
	mx[v]=max(mx[lc],mx[rc])+laz[v];
}
ll get(ll x,ll s=0,ll t=n,ll v=1){
	if(t-s==1) return mx[v];
	ll mid=(s+t)>>1;
	if(x<mid) return get(x,s,mid,lc)+laz[v];
	else      return get(x,mid,t,rc)+laz[v];
}

void guzman(ll *xx){
	memset(mx,0,sizeof(mx)), memset(laz,0,sizeof(laz));
	vector<ll> v; v.pb(0);
	for(int i=1;i<n;i++){
		while(a[v.back()]>a[i]) v.pop_back();
		add(i,i+1,get(v.back())+1);
		add(v.back()+1,i,1);
		xx[i]=mx[1];
		v.pb(i);
		//cout<<i<<' '<<a[i]<<' '<<xx[i]<<endl;
	}
}

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	cin>>n;
	for(int i=0;i<n;i++){
		cin>>b[i];
		if(b[i]==1) s=i;
	}
	for(int i=1;i<n;i++) a[i]=b[(s+i)%n];
	guzman(dp), reverse(a+1,a+n), guzman(pd);
	pll ans={mod,mod}; for(int ii=s,i=0;i<n;i++,ii--,ii+=n,ii%=n) ans=min(ans,{1+max(dp[n-1-ii],pd[ii]),i});
	cout<<ans.F<<' '<<ans.S;

	return 0;
}


#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <utility>
#include <iostream>
#include <cmath>
#include <deque>
#include <string>
#include <time.h>
#include <stack>

#define pii pair<ll,ll>
#define X first
#define Y second
#define mp make_pair

typedef int ll;
using namespace std;
#define MAXN 30000
#define MOD 1000000007
#define N 1048576
ll n, x, k, z, m, pos, q, ans_v;

ll b[200500];
ll a[200500], c[200500];
vector<ll> comp;
struct hyu {
    ll x;
    ll y;
    ll z;
};
bool operator < (const hyu &x, const hyu& y) {
    return std::tie(x.x, x.y, x.z) < std::tie(y.x, y.y, y.z);
}
set<hyu> f;
vector<pii> g;

ll calc(ll m) {
    if (m == 0) {
        return 0;
    }
    f.clear();
    f.insert({0, m-1, 0});
    g.clear();
    for (int i = 0; i < m; i++) {
        g.push_back(mp(c[i], i));
    }
    sort(g.begin(), g.end());
    ll ans = 0;
    for (auto v : g) {
        ll i = v.Y;
        auto it = f.upper_bound({i, MOD, 0});
        it--;
        ll l = it->x;
        ll r = it->y;
        ll val = it->z;

        f.erase(it);
        ans = max(ans, val);
        if (l == r) {
            continue;
        }

        if (l == i) {
            f.insert({l+1, r, val + 1});
        }

        if (r == i) {
            f.insert({l, r-1, val+1});
        }
        f.insert({l, i-1, val+1});
        f.insert({i+1, r, val+1});
    }
    return ans + 1;
}
ll gt(ll x) {
    ll p = 0;
    for (int i = 0; i < x; i++) {
        c[p++] = b[i];
    }
    ll t = calc(p);
    p = 0;
    for (int i = x; i < n-1; i++) {
        c[p++] = b[i];
    }
    ll tt = calc(p);
    return max(t, tt);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] == 1) {
            k = i;
        }
    }
    ll pos = 0;
    for (int i = k + 1; i < n; i++) {
        b[pos++] = a[i];
    }
    for (int i = 0; i < k; i++) {
        b[pos++] = a[i];
    }

    ll l = 0, r = pos;
    while (r - l > 2) {
        ll m1 = l + (r - l) / 3;
        ll m2 = r - (r - l) / 3;
        if (gt(m1) <= gt(m2)) {
            r = m2;
        } else {
            l = m1;
        }
    }

    ll cur_ans = MOD, pi = -1;
    for (int i = l; i <= r; i++) {
        ll p = gt(i);
        if (p <= cur_ans) {
            cur_ans = p;
            pi = i;
        }
    }
    cout << cur_ans+1 << " " << (k + (n - (n - 1 - pi)) + 2 * n ) % n << endl;
    return 0;
}


#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <utility>
#include <iostream>
#include <cmath>
#include <deque>
#include <string>
#include <time.h>
#include <stack>

#define pii pair<ll,ll>
#define X first
#define Y second
#define mp make_pair

typedef long long ll;
using namespace std;
#define MAXN 30000
#define MOD 1000000007
#define N 1048576
ll n, x, k, z, m, pos, q, ans_v;

ll b[200500];
ll a[200500], c[200500];
vector<ll> comp;
set<pair<pii, ll>> f;
vector<pii> g;

ll calc(ll m) {
    if (m == 0) {
        return 0;
    }
    f.clear();
    f.insert(mp(mp(0, m-1), 0));
    g.clear();
    for (int i = 0; i < m; i++) {
        g.push_back(mp(c[i], i));
    }
    sort(g.begin(), g.end());
    ll ans = 0;
    for (auto v : g) {
        ll i = v.Y;
        auto it = f.upper_bound(mp(mp(i, MOD), 0));
        it--;
        ll l = (it->X).X;
        ll r = (it->X).Y;
        ll val = it->Y;

        f.erase(it);
        ans = max(ans, val);
        if (l == r) {
            continue;
        }

        if (l == i) {
            f.insert(mp(mp(l+1, r), val + 1));
        }

        if (r == i) {
            f.insert(mp(mp(l, r-1), val + 1));
        }
        f.insert(mp(mp(l, i-1), val + 1));
        f.insert(mp(mp(i+1, r), val + 1));
    }
    return ans + 1;
}
ll gt(ll x) {
    ll p = 0;
    for (int i = 0; i < x; i++) {
        c[p++] = b[i];
    }
    ll t = calc(p);
    p = 0;
    for (int i = x; i < n-1; i++) {
        c[p++] = b[i];
    }
    ll tt = calc(p);
    return max(t, tt);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] == 1) {
            k = i;
        }
    }
    ll pos = 0;
    for (int i = k + 1; i < n; i++) {
        b[pos++] = a[i];
    }
    for (int i = 0; i < k; i++) {
        b[pos++] = a[i];
    }

    ll l = 0, r = pos;
    while (r - l > 2) {
        ll m1 = l + (r - l) / 3;
        ll m2 = r - (r - l) / 3;
        if (gt(m1) <= gt(m2)) {
            r = m2;
        } else {
            l = m1;
        }
    }

    ll cur_ans = MOD, pi = -1;
    for (int i = l; i <= r; i++) {
        ll p = gt(i);
        if (p <= cur_ans) {
            cur_ans = p;
            pi = i;
        }
    }
    cout << cur_ans+1 << " " << (k + (n - (n - 1 - pi)) + 2 * n ) % n << endl;
    return 0;
}


#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <utility>
#include <iostream>
#include <cmath>
#include <deque>
#include <string>
#include <time.h>
#include <stack>

#define pii pair<ll,ll>
#define X first
#define Y second
#define mp make_pair

typedef long long ll;
using namespace std;
#define MAXN 30000
#define MOD 1000000007
#define N 1048576
ll n, x, k, z, m, pos, q, ans_v;

ll b[200500];
ll a[200500], c[200500], pl[200500], pr[200500], val[200500], revb[200500], used[200500];
vector<ll> comp;
vector<ll> g;

ll calc(ll tl, ll tr) {
    if (tl > tr) {
        return 0;
    }
    g.clear();
    for (int i = 1; i <= n; i++) {
        used[i] = 0;
    }
    for (int i = tl; i <= tr; i++) {
        used[b[i]] = 1;
    }
    ll pos = 0;
    for (int i = 1; i <= n; i++) {
        if (used[i]) {
            revb[i] = pos++;
        }
    }
    for (int i = tl; i <= tr; i++) {
        g.push_back(revb[b[i]]);
    }
    ll m = tr-tl+1;
    for (int i = 0; i < tr-tl+1; i++) {
        pl[i] = i + 1;
        pr[i] = i - 1;
        val[i] = 0;
    }
    for (auto v : g) {
        pl[v] = pr[v] = v;
        bool is_l = (v > 0 && pr[v-1] == v-1);
        bool is_r = (v < m - 1 && pl[v+1] == v + 1);
        ll l, r;
        if (is_l && is_r) {
            l = pl[v-1];
            r = pr[v+1];
        }

        if (is_l && !is_r) {
            l = pl[v-1];
            r = v;
        }

        if (!is_l && is_r) {
            l = v;
            r = pr[v+1];
        }

        if (!is_l && !is_r) {
            l = r = v;
        }

        val[l] = val[r] = max(val[l], val[r]) + 1;
        pl[l] = l;
        pr[r] = r;
        pr[l] = r;
        pl[r] = l;
    }
    //cout << "val:" << val[0] << endl;
    return val[0];
}
ll gt(ll x) {
    ll p = 0;
    ll t = calc(0, x-1);
    ll tt = calc(x, n-2);
    return max(t, tt);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] == 1) {
            k = i;
        }
    }
    ll pos = 0;
    for (int i = k + 1; i < n; i++) {
        b[pos++] = a[i];
    }
    for (int i = 0; i < k; i++) {
        b[pos++] = a[i];
    }

    ll l = 0, r = pos;
    while (r - l > 2) {
        ll m1 = l + (r - l) / 3;
        ll m2 = r - (r - l) / 3;
        if (gt(m1) <= gt(m2)) {
            r = m2;
        } else {
            l = m1;
        }
    }

    ll cur_ans = MOD, pi = -1;
    for (int i = l; i <= r; i++) {
        ll p = gt(i);
        if (p <= cur_ans) {
            cur_ans = p;
            pi = i;
        }
    }
    cout << cur_ans+1 << " " << (k + (n - (n - 1 - pi)) + 2 * n ) % n << endl;
    return 0;
}


#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <utility>
#include <iostream>
#include <cmath>
#include <deque>
#include <string>
#include <time.h>
#include <stack>

#define pii pair<ll,ll>
#define X first
#define Y second
#define mp make_pair

typedef long long ll;
using namespace std;
#define MAXN 30000
#define MOD 1000000007
#define N 1048576
ll n, x, k, z, m, pos, q, ans_v;

ll b[200500];
ll a[200500], c[200500], pl[200500], pr[200500], val[200500];
vector<ll> comp;
set<pair<pii, ll>> f;
vector<pii> g;

ll calc(ll m) {
    if (m == 0) {
        return 0;
    }
    f.clear();
    f.insert(mp(mp(0, m-1), 0));
    g.clear();
    for (int i = 0; i < m; i++) {
        g.push_back(mp(c[i], i));
    }
    for (int i = 0; i < m; i++) {
        pl[i] = i + 1;
        pr[i] = i - 1;
        val[i] = 0;
    }
    sort(g.begin(), g.end());
    reverse(g.begin(), g.end());
    for (auto& [x, v] : g) {
        pl[v] = pr[v] = v;
        bool is_l = (v > 0 && pr[v-1] == v-1);
        bool is_r = (v < m - 1 && pl[v+1] == v + 1);
        ll l, r;
        if (is_l && is_r) {
            l = pl[v-1];
            r = pr[v+1];
        }

        if (is_l && !is_r) {
            l = pl[v-1];
            r = v;
        }

        if (!is_l && is_r) {
            l = v;
            r = pr[v+1];
        }

        if (!is_l && !is_r) {
            l = r = v;
        }

        val[l] = val[r] = max(val[l], val[r]) + 1;
        pl[l] = l;
        pr[r] = r;
        pr[l] = r;
        pl[r] = l;
    }
    return val[0];
}
ll gt(ll x) {
    ll p = 0;
    for (int i = 0; i < x; i++) {
        c[p++] = b[i];
    }
    ll t = calc(p);
    p = 0;
    for (int i = x; i < n-1; i++) {
        c[p++] = b[i];
    }
    ll tt = calc(p);
    return max(t, tt);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] == 1) {
            k = i;
        }
    }
    ll pos = 0;
    for (int i = k + 1; i < n; i++) {
        b[pos++] = a[i];
    }
    for (int i = 0; i < k; i++) {
        b[pos++] = a[i];
    }

    ll l = 0, r = pos;
    while (r - l > 2) {
        ll m1 = l + (r - l) / 3;
        ll m2 = r - (r - l) / 3;
        if (gt(m1) <= gt(m2)) {
            r = m2;
        } else {
            l = m1;
        }
    }

    ll cur_ans = MOD, pi = -1;
    for (int i = l; i <= r; i++) {
        ll p = gt(i);
        if (p <= cur_ans) {
            cur_ans = p;
            pi = i;
        }
    }
    cout << cur_ans+1 << " " << (k + (n - (n - 1 - pi)) + 2 * n ) % n << endl;
    return 0;
}


#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <utility>
#include <iostream>
#include <cmath>
#include <deque>
#include <string>
#include <time.h>
#include <stack>

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define pii pair<ll,ll>
#define X first
#define Y second
#define mp make_pair

typedef int ll;
using namespace std;
#define MAXN 30000
#define MOD 1000000007
#define N 1048576
ll n, x, k, z, m, pos, q, ans_v;

ll b[200500];
ll a[200500], c[200500];
vector<ll> comp;
struct hyu {
    ll x;
    ll y;
    ll z;
};
bool operator < (const hyu &x, const hyu& y) {
    return std::tie(x.x, x.y, x.z) < std::tie(y.x, y.y, y.z);
}
set<hyu> f;
vector<pii> g;

ll calc(ll m) {
    if (m == 0) {
        return 0;
    }
    f.clear();
    f.insert({0, m-1, 0});
    g.clear();
    for (int i = 0; i < m; i++) {
        g.push_back(mp(c[i], i));
    }
    sort(g.begin(), g.end());
    ll ans = 0;
    for (auto v : g) {
        ll i = v.Y;
        auto it = f.upper_bound({i, MOD, 0});
        it--;
        ll l = it->x;
        ll r = it->y;
        ll val = it->z;

        f.erase(it);
        ans = max(ans, val);
        if (l == r) {
            continue;
        }

        if (l == i) {
            f.insert({l+1, r, val + 1});
        }

        if (r == i) {
            f.insert({l, r-1, val+1});
        }
        f.insert({l, i-1, val+1});
        f.insert({i+1, r, val+1});
    }
    return ans + 1;
}
ll gt(ll x) {
    ll p = 0;
    for (int i = 0; i < x; i++) {
        c[p++] = b[i];
    }
    ll t = calc(p);
    p = 0;
    for (int i = x; i < n-1; i++) {
        c[p++] = b[i];
    }
    ll tt = calc(p);
    return max(t, tt);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] == 1) {
            k = i;
        }
    }
    ll pos = 0;
    for (int i = k + 1; i < n; i++) {
        b[pos++] = a[i];
    }
    for (int i = 0; i < k; i++) {
        b[pos++] = a[i];
    }

    ll l = 0, r = pos;
    while (r - l > 2) {
        ll m1 = l + (r - l) / 3;
        ll m2 = r - (r - l) / 3;

        if (m1 + 10000 < m2) {
            m1 += 10000;
        }
        if (gt(m1) <= gt(m2)) {
            r = m2;
        } else {
            l = m1;
        }
    }

    ll cur_ans = MOD, pi = -1;
    for (int i = l; i <= r; i++) {
        ll p = gt(i);
        if (p <= cur_ans) {
            cur_ans = p;
            pi = i;
        }
    }
    cout << cur_ans+1 << " " << (k + (n - (n - 1 - pi)) + 2 * n ) % n << endl;
    return 0;
}


#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <utility>
#include <iostream>
#include <cmath>
#include <deque>
#include <string>
#include <time.h>
#include <stack>

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define pii pair<ll,ll>
#define X first
#define Y second
#define mp make_pair

typedef int ll;
using namespace std;
#define MAXN 30000
#define MOD 1000000007
#define N 1048576
ll n, x, k, z, m, pos, q, ans_v;

ll b[200500];
ll a[200500], c[200500];
vector<ll> comp;
struct hyu {
    ll x;
    ll y;
    ll z;
};
bool operator < (const hyu &x, const hyu& y) {
    return std::tie(x.x, x.y, x.z) < std::tie(y.x, y.y, y.z);
}
set<hyu> f;
vector<pii> g;

ll calc(ll m) {
    if (m == 0) {
        return 0;
    }
    f.clear();
    f.insert({0, m-1, 0});
    g.clear();
    for (int i = 0; i < m; i++) {
        g.push_back(mp(c[i], i));
    }
    sort(g.begin(), g.end());
    ll ans = 0;
    for (auto v : g) {
        ll i = v.Y;
        auto it = f.upper_bound({i, MOD, 0});
        it--;
        ll l = it->x;
        ll r = it->y;
        ll val = it->z;

        f.erase(it);
        ans = max(ans, val);
        if (l == r) {
            continue;
        }

        if (l == i) {
            f.insert({l+1, r, val + 1});
        }

        if (r == i) {
            f.insert({l, r-1, val+1});
        }
        f.insert({l, i-1, val+1});
        f.insert({i+1, r, val+1});
    }
    return ans + 1;
}
ll gt(ll x) {
    ll p = 0;
    for (int i = 0; i < x; i++) {
        c[p++] = b[i];
    }
    ll t = calc(p);
    p = 0;
    for (int i = x; i < n-1; i++) {
        c[p++] = b[i];
    }
    ll tt = calc(p);
    return max(t, tt);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] == 1) {
            k = i;
        }
    }
    ll pos = 0;
    for (int i = k + 1; i < n; i++) {
        b[pos++] = a[i];
    }
    for (int i = 0; i < k; i++) {
        b[pos++] = a[i];
    }

    ll l = 0, r = pos;
    while (r - l > 2) {
        ll m1 = l + (r - l) / 3;
        ll m2 = r - (r - l) / 3;
        if (gt(m1) <= gt(m2)) {
            r = m2;
        } else {
            l = m1;
        }
    }

    ll cur_ans = MOD, pi = -1;
    for (int i = l; i <= r; i++) {
        ll p = gt(i);
        if (p <= cur_ans) {
            cur_ans = p;
            pi = i;
        }
    }
    cout << cur_ans+1 << " " << (k + (n - (n - 1 - pi)) + 2 * n ) % n << endl;
    return 0;
}