#include <bits/stdc++.h>
using namespace std;
const long long inf = (1LL << 60) - 1;
int n, a, b;
vector<int> p;
map<tuple<long long, int, int>, int> dp;
long long go(long long Or, int i, int k) {
if (i == n) return a <= k && k <= b ? inf : 0;
if (dp.find({Or, i, k}) != dp.end()) return dp[{Or, i, k}];
long long ans = inf, cur = 0;
for (int j = i; j < n; j++) {
cur += p[j];
ans = min(ans, Or | cur | go(Or | cur, j + 1, k + 1));
}
return dp[{Or, i, k}] = ans;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n >> a >> b;
p.resize(n);
for (int &x : p) {
cin >> x;
}
cout << go(0, 0, 0) << '\n';
return 0;
}