#include <bits/stdc++.h>
using namespace std;
const int size = 1000007;
const long long modulo = 1000000007;
const int INF = 2e9;
const double EPS = 1e-10;
int b[size];
int get(int n) {
  int res = INF;
  for (; n >= 0; n = (n & (n + 1)) - 1) res = min(res, b[n]);
  return res;
}
void add(int n, int delta) {
  for (; n < size; n |= n + 1) b[n] = min(b[n], delta);
}
int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  sort(x.begin(), x.end());
  int R, r;
  cin >> R >> r;
  vector<int> best(R - r + 1, 1);
  for (int i = 0; i < n; i++) {
    if (i == 0 || x[i] != x[i - 1]) {
      for (int j = (r + x[i] - 1) / x[i] * x[i]; j <= R; j += x[i])
        best[j - r] = x[i];
    }
  }
  for (int i = 0; i < R - r; i++) b[i] = INF;
  add(R - r, 0);
  int previ = 0;
  for (int i = R - r - 1; i >= 0; i--) {
    int cur = previ + 1;
    int delta = best[i] - 1;
    cur = min(cur, get(min(i + delta, R - r)) + 1);
    add(i, cur);
    previ = cur;
  }
  cout << previ << endl;
  return 0;
}
