#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> maxdiv, d, x;
int l, r;
int main() {
  scanf("%d", &n);
  x.assign(n, 0);
  for (int i = 0; i < n; ++i) scanf("%d", &x[i]);
  sort(x.begin(), x.end());
  n = unique(x.begin(), x.end()) - x.begin();
  scanf("%d%d", &r, &l);
  maxdiv.assign(r - l + 1, 1);
  for (int i = 0; i < n; ++i) {
    int pos = l / x[i];
    if (l % x[i]) pos++;
    pos *= x[i];
    while (pos <= r) {
      maxdiv[pos - l] = max(maxdiv[pos - l], x[i]);
      pos += x[i];
    }
  }
  d.assign(r - l + 1, 1000000000);
  d[0] = 0;
  int nd = 0;
  int npos = 1;
  for (int i = 0; i <= r - l;) {
    int ni = i;
    while (ni <= r - l && d[ni] == d[i]) ++ni;
    if (ni > r - l) {
      printf("%d\n", d[i]);
      return 0;
    }
    int rr = ni;
    for (int j = i; j < ni; ++j) rr = max(rr, j + maxdiv[j] - 1);
    for (int j = ni; j <= rr && j <= r - l; ++j) d[j] = d[i] + 1;
    i = ni;
  }
  return 0;
}
