#include <bits/stdc++.h>
const double eps = 1e-9;
const long double pi = acos(-1.0);
using namespace std;
const int N = 5e6 + 1;
int n, a, b;
int x[N], mp[N];
void solve() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> x[i];
  sort(x + 1, x + n + 1);
  cin >> a >> b;
  swap(a, b);
  int last_a = a;
  a -= last_a;
  b -= last_a;
  for (int i = 1; i <= b * 2; i++) mp[i] = i - 1;
  for (int i = 1; i <= n; i++) {
    if (x[i] == x[i - 1]) continue;
    int pos = x[i];
    if (pos < last_a) pos = last_a + (x[i] - last_a % x[i]) % x[i];
    pos -= last_a;
    while (1) {
      pos += x[i];
      if (pos > b) {
        if (pos - 1 >= b && mp[b] > pos - x[i]) mp[b] = pos - x[i];
        break;
      }
      if (mp[pos - 1] > pos - x[i]) mp[pos - 1] = pos - x[i];
    }
  }
  int mn = 1e9;
  for (int i = b; i >= 1; i--) {
    mn = min(mn, mp[i]);
    mp[i] = mn;
  }
  int ans = 0;
  while (b != a) {
    b = mp[b];
    ans++;
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(10);
  int step;
  step = 1;
  for (int i = 1; i <= step; i++) {
    solve();
  }
}
