#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
vector<int> a;
int n, dp[N], tree[N << 2], x, y, step, h[N];
inline void init() {
  for (int i = 0; i < (N << 2); i++) tree[i] = 1e9;
}
int query(int ind, int l, int r, int lw, int rw) {
  if (l > rw || r < lw) return 1e9;
  if (l >= lw && r <= rw) return tree[ind];
  int mid = (l + r) / 2;
  return min(query(ind + ind, l, mid, lw, rw),
             query(ind + ind + 1, mid + 1, r, lw, rw));
}
void update(int ind, int l, int r, int w, int val) {
  if (l > w || r < w) return;
  if (l == w && r == w) {
    tree[ind] = val;
    return;
  }
  int mid = (l + r) / 2;
  update(ind + ind, l, mid, w, val);
  update(ind + ind + 1, mid + 1, r, w, val);
  tree[ind] = min(tree[ind + ind], tree[ind + ind + 1]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int asd;
    cin >> asd;
    a.push_back(asd);
  }
  cin >> y >> x;
  sort(a.begin(), a.end());
  a.resize(unique(a.begin(), a.end()) - a.begin());
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == 1) continue;
    for (int j = x / a[i] * a[i]; j <= y; j += a[i])
      if (j >= x) h[j - x] = a[i];
  }
  init();
  int m = y - x;
  dp[y - x] = 0;
  update(1, 1, m, y - x, 0);
  for (int i = y - 1; i >= x; i--) {
    int k = i - x, mn = h[i - x];
    dp[k] = dp[k + 1] + 1;
    if (mn == 0)
      dp[k] = dp[k + 1] + 1;
    else
      dp[k] = query(1, 1, m, k, min(m, k + mn - 1)) + 1;
    update(1, 1, m, k, dp[k]);
  }
  cout << dp[0] << endl;
}
