#include
using namespace std;
typedef long long qw; typedef pair <qw, int> dpair;
#ifdef WIN32 #define lld “%I64d” #else #define lld “%lld” #endif
const int maxn = 13; const int maxw = 400009;
int n, w[maxn]; qw b0, b1, d[maxw]; dpair hp[maxn * maxw];
void dijkstra() { int th = 1; memset(d, -1, sizeof(d)); hp[0] = dpair(0, 0); while (th) { dpair g = hp[0]; pop_heap(hp, hp + (th –)); if (d[g. second] > -1) continue; d[g. second] = -g. first; for (int i = 0; i < n; ++ i) { hp[th] = dpair(g. first - w[i], (g. second + w[i]) % w[0]); if (d[hp[th]. second] == -1) push_heap(hp, hp + (++ th)); } } }
qw calc(qw x) { qw s = x; if (x == 0) return 0; for (int i = 0; i < w[0]; ++ i) if (d[i] <= x && d[i] > -1) s -= d[i] / w[0]; else s -= x / w[0] + (x % w[0] >= i); return s;
}
int main() { #ifndef ONLINE_JUDGE freopen(“in.txt”, “r”, stdin); #endif
scanf("%d" lld lld, &n, &b0, &b1);
for (int i = 0; i < n; ++ i)
scanf("%d", w + i);
sort(w, w + n);
dijkstra();
printf(lld "\n", calc(b1) - calc(b0 - 1));
}