#include <bits/stdc++.h>
using namespace std;
int avl = 0;
int ll[4123456][2];
int x[112345];
int biggest_x[1123456];
int head[1123456];
int firstp[1123456];
int steps[1123456];
int bit[1123456];
void bit_update(int x, int val) {
  x += 1;
  for (++x; x < 1123456; x += x & -x) bit[x] = min(bit[x], val);
}
int bit_query(int x) {
  x += 1;
  int ret = 1123456;
  for (++x; x; x -= x & -x) ret = min(ret, bit[x]);
  return ret;
}
int new_node(int v) {
  int n = avl++;
  ll[n][0] = v;
  ll[n][1] = -1;
  return n;
}
void add(int at, int n) {
  if (firstp[at] == -1) {
    firstp[at] = n;
    head[at] = n;
  } else {
    ll[head[at]][1] = n;
    head[at] = n;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &x[i]);
  sort(x, x + n);
  n = unique(x, x + n) - x;
  int l, u;
  scanf("%d%d", &u, &l);
  for (int i = 0; i < 1123456; i++) bit[i] = 1123456;
  for (int i = l; i <= u; i++) steps[i - l] = u - i;
  for (int i = l; i <= u; i++) bit_update(i - l, u - i);
  for (int i = l; i <= u; i++) biggest_x[i - l] = 2;
  for (int i = 0; i < n; i++) {
    int fv = u - (u % x[i]);
    while (fv >= l) {
      biggest_x[fv - l] = max(biggest_x[fv - l], x[i]);
      fv -= x[i];
    }
  }
  for (int i = u - 1; i >= l; i--) {
    int pos = i + biggest_x[i - l] - 1;
    pos = min(u, pos);
    steps[i - l] = bit_query(pos - l) + 1;
    bit_update(i - l, steps[i - l]);
  }
  printf("%d\n", steps[0]);
  return 0;
}
