#include <bits/stdc++.h>
using namespace std;
int INF = 1000000000;
vector<int> T;
int l, size;
void Stworz(int n) {
  int p = 1;
  while (p <= n) p *= 2;
  l = p;
  size = 2 * p - 1;
  for (int i = 0; i <= size; ++i) T.push_back(INF);
}
void Dodaj(int a, int x) {
  a += l;
  T[a] = x;
  a /= 2;
  while (a != 0) {
    T[a] = min(T[2 * a], T[2 * a + 1]);
    a /= 2;
  }
}
int Mini(int a, int b) {
  a += l;
  b += l;
  a = min(a, size);
  b = min(b, size);
  int odp = min(T[a], T[b]);
  while (a / 2 != b / 2) {
    if (a % 2 == 0) odp = min(odp, T[a + 1]);
    if (b % 2 == 1) odp = min(odp, T[b - 1]);
    a /= 2;
    b /= 2;
  }
  return odp;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> x;
  set<int> S;
  for (int i = 0; i < n; ++i) {
    int d;
    cin >> d;
    if (S.find(d) == S.end()) {
      x.push_back(d);
      S.insert(d);
    }
  }
  int a, b;
  cin >> b >> a;
  int il = b - a + 1;
  vector<int> max_d(il, -1);
  for (int i = 0; i < x.size(); ++i) {
    int j;
    if (a % x[i] == 0)
      j = a;
    else
      j = a - a % x[i] + x[i];
    while (j <= b) {
      max_d[j - a] = max(max_d[j - a], x[i]);
      j += x[i];
    }
  }
  Stworz(il);
  vector<int> dp(il, INF);
  dp[b - a] = 0;
  Dodaj(b - a, 0);
  for (int i = b - 1; i >= a; --i) {
    if (max_d[i - a] != -1)
      dp[i - a] = Mini(i + 1 - a, i + max_d[i - a] - 1 - a) + 1;
    dp[i - a] = min(dp[i - a], dp[i + 1 - a] + 1);
    Dodaj(i - a, dp[i - a]);
  }
  cout << dp[0];
  return 0;
}
