#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int a[N];
int main() {
freopen("MUASAM.INP","r",stdin);
freopen("MUASAM.OUT","w",stdout);
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n,l,r; cin >> n >> l >> r;
multiset<int> s;
for (int i = 1; i <= n; i++) cin >> a[i];
s.insert(a[1]);
int ans = INT_MAX;
for (int i = 2; i <= n; i++) {
if (s.lower_bound(l-a[i]) != s.end()) {
int target = *s.lower_bound(l-a[i]);
if (target <= r - a[i]) {
ans = min(ans, a[i] + target);
}
}
s.insert(a[i]);
}
cout << ans;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE4gPSAxZTYgKyA1OwppbnQgYVtOXTsKCmludCBtYWluKCkgewogICAgZnJlb3BlbigiTVVBU0FNLklOUCIsInIiLHN0ZGluKTsKICAgIGZyZW9wZW4oIk1VQVNBTS5PVVQiLCJ3IixzdGRvdXQpOwogICAgaW9zOjpzeW5jX3dpdGhfc3RkaW8oMCksICAgIGNpbi50aWUoMCksIGNvdXQudGllKDApOwoKICAgIGludCBuLGwscjsgIGNpbiA+PiBuID4+IGwgPj4gcjsKICAgIG11bHRpc2V0PGludD4gczsKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IG47IGkrKykgICAgY2luID4+IGFbaV07CgogICAgcy5pbnNlcnQoYVsxXSk7CiAgICBpbnQgYW5zID0gSU5UX01BWDsKICAgIGZvciAoaW50IGkgPSAyOyBpIDw9IG47IGkrKykgewogICAgICAgIGlmIChzLmxvd2VyX2JvdW5kKGwtYVtpXSkgIT0gcy5lbmQoKSkgewogICAgICAgICAgICBpbnQgdGFyZ2V0ID0gKnMubG93ZXJfYm91bmQobC1hW2ldKTsKICAgICAgICAgICAgaWYgKHRhcmdldCA8PSByIC0gYVtpXSkgICAgIHsKICAgICAgICAgICAgICAgIGFucyA9IG1pbihhbnMsIGFbaV0gKyB0YXJnZXQpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0KGFbaV0pOwogICAgfQogICAgY291dCA8PCBhbnM7CiAgICByZXR1cm4gMDsKfQo=