#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int n,l,r;
cin>>n>>l>>r;
vector<int> a(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
int i=0,j=0;
int k=r-l+1;
int minWin=n;
int minInd=-1;
unordered_map<int,int> mp;
while(j<n){
if(a[j]>=l&&a[j]<=r){
mp[a[j]]++;
}
if(mp.size()==k){
while(mp.size()==k){
if(j-i+1<minWin){
minWin = j-i+1;
minInd= i;
}
if(mp.find(a[i])!=mp.end()){
mp[a[i]]--;
if(mp[a[i]]==0){
mp.erase(a[i]);
}
}
i++;
}
}
j++;
}
if(minInd==-1){
cout<<-1;
}else{
cout<<minInd+1; //1 based indexing
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCS8vIHlvdXIgY29kZSBnb2VzIGhlcmUKCWludCBuLGwscjsKCWNpbj4+bj4+bD4+cjsKCXZlY3RvcjxpbnQ+IGEobik7Cglmb3IoaW50IGk9MDtpPG47aSsrKXsKCQljaW4+PmFbaV07Cgl9CglpbnQgaT0wLGo9MDsKCWludCBrPXItbCsxOwoJaW50IG1pbldpbj1uOwoJaW50IG1pbkluZD0tMTsKCXVub3JkZXJlZF9tYXA8aW50LGludD4gbXA7Cgl3aGlsZShqPG4pewoJCWlmKGFbal0+PWwmJmFbal08PXIpewoJCQltcFthW2pdXSsrOwoJCX0KCQlpZihtcC5zaXplKCk9PWspewoJCQl3aGlsZShtcC5zaXplKCk9PWspewoJCQkJaWYoai1pKzE8bWluV2luKXsKCQkJCQltaW5XaW4gPSBqLWkrMTsKCQkJCQltaW5JbmQ9IGk7CgkJCQl9CgkJCQlpZihtcC5maW5kKGFbaV0pIT1tcC5lbmQoKSl7CgkJCQkJbXBbYVtpXV0tLTsKCQkJCQlpZihtcFthW2ldXT09MCl7CgkJCQkJCW1wLmVyYXNlKGFbaV0pOwoJCQkJCX0KCQkJCX0KCQkJCWkrKzsKCQkJfQoJCX0KCQlqKys7Cgl9CglpZihtaW5JbmQ9PS0xKXsKCQljb3V0PDwtMTsKCX1lbHNlewoJCQljb3V0PDxtaW5JbmQrMTsgLy8xIGJhc2VkIGluZGV4aW5nCgl9CgoJcmV0dXJuIDA7Cn0=