#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, M = 1e6 + 10;
int mn[M << 2];
inline int min(int a, int b) { return a < b ? a : b; }
void update(int rt, int l, int r, int p, int x) {
  if (l == r) {
    mn[rt] = x;
    return;
  }
  int m = (l + r) >> 1;
  if (p <= m)
    update(rt << 1, l, m, p, x);
  else
    update(rt << 1 | 1, m + 1, r, p, x);
  mn[rt] = min(mn[rt << 1], mn[rt << 1 | 1]);
}
int query(int rt, int l, int r, int ql, int qr) {
  if (ql <= l && r <= qr) return mn[rt];
  int m = (l + r) >> 1, lans = 1e9, rans = 1e9;
  if (ql <= m) lans = query(rt << 1, l, m, ql, qr);
  if (qr > m) rans = query(rt << 1 | 1, m + 1, r, ql, qr);
  return min(lans, rans);
}
int n, x[N], a, b, f[M], g[M];
int main() {
  register int i, j;
  int m;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &x[i]);
  scanf("%d%d", &b, &a);
  sort(x + 1, x + 1 + n);
  n = unique(x + 1, x + 1 + n) - x - 1;
  m = b - a + 1;
  for (i = 1; i <= n; i++)
    for (j = a / x[i] * x[i]; j <= b; j += x[i])
      if (j >= a && g[j - a + 1] < x[i]) g[j - a + 1] = x[i];
  for (i = 1; i <= m; i++)
    if (g[i])
      --g[i];
    else
      ++g[i];
  for (i = m - 1; i; i--)
    f[i] = query(1, 1, m, i + 1, min(i + g[i], m)) + 1,
    update(1, 1, m, i, f[i]);
  printf("%d\n", f[1]);
  return 0;
}
