#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000000;
long long POW(long long a, long long b, long long MMM = MOD) {
  long long ret = 1;
  for (; b; b >>= 1, a = (a * a) % MMM)
    if (b & 1) ret = (ret * a) % MMM;
  return ret;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  if (a == 0 || b == 0) return a + b;
  return a * (b / gcd(a, b));
}
int dx[] = {0, -1, 1, 0}, dy[] = {1, 0, 0, -1};
int ddx[] = {0, 0, 1, 1, 1, -1, -1, -1}, ddy[] = {1, -1, 1, 0, -1, 1, 0, -1};
vector<int> v;
vector<pair<int, int> > pr;
int d[1000001], MAX[1000001];
int main() {
  int n, a, b;
  scanf("%d", &n);
  for (int(i) = (0); (i) <= (n - 1); (i) += (1)) {
    int x;
    scanf("%d", &x);
    v.push_back(x);
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  scanf("%d%d", &a, &b);
  int N = a - b;
  for (int x : v) {
    int fi = ((b - 1) / x + 1) * x;
    for (int(i) = (fi); (i) <= (a); (i) += (x)) MAX[i - b] = x;
  }
  pr.push_back(make_pair(-a, 0));
  for (int(i) = (a - 1); (i) >= (b); (i) -= (1)) {
    int ii = i - b;
    int t = MAX[ii];
    d[ii] = d[ii + 1] + 1;
    if (t != 0) {
      int tt = lower_bound(pr.begin(), pr.end(), make_pair(-i - t + 1, -1)) -
               pr.begin();
      if (tt != (int)pr.size()) {
        d[ii] = min(d[ii], pr[tt].second + 1);
      }
    }
    while (!pr.empty() && pr.back().second >= d[ii]) pr.pop_back();
    pr.push_back(make_pair(-i, d[ii]));
  }
  printf("%d", d[0]);
}
