#include <bits/stdc++.h>
using namespace std;
template <typename T>
using vc = vector<T>;
using pii = pair<int, int>;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vc<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  vc<int> b;
  int last = -1;
  for (int i = 0; i < n; i++) {
    if (a[i] != last) b.push_back(a[i]);
    last = a[i];
  }
  a = b;
  int start, ende;
  cin >> start >> ende;
  vc<vc<int> > care(start - ende + 1);
  vc<int> next(start - ende + 1, start);
  int mini = start;
  for (int i = 0; i < a.size(); i++) {
    if (start % a[i] > start - ende) continue;
    mini = min(mini, start - start % a[i]);
    care[start % a[i]].push_back(a[i]);
  }
  for (int i = 0; i < start - ende + 1; i++) {
    next[i] = min(mini, start - i - 1);
    for (int j = 0; j < care[i].size(); j++) {
      int x = care[i][j];
      if (i + x >= start - ende + 1) continue;
      if (mini < start - i - x) {
        int to = mini - mini % x + x;
        if (to < ende) continue;
        int ind = start - to;
        care[ind].push_back(x);
      } else {
        care[i + x].push_back(x);
        mini = min(mini, start - i - x);
      }
    }
    if (i == 1000 && n == 1000000) assert(0);
  }
  int cur = 0;
  int res = 0;
  while (cur != start - ende) {
    cur = start - next[cur];
    res++;
  }
  cout << res << "\n";
}
