#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int n;
int m;
vector<int> h[1000010];
int x[100010], f[1000010], e[1000010];
int main() {
  int a, b;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &x[i]);
  sort(x, x + n);
  n = unique(x, x + n) - x;
  scanf("%d%d", &a, &b);
  int ab = a - b + 1;
  for (int i = 0; i <= ab; i++) h[i].reserve(10);
  cerr << clock() << endl;
  for (int i = 0; i < n; i++) {
    int j = x[i] * (b / x[i]);
    while (j < b) j += x[i];
    j = j - b + 1;
    if (j <= ab) h[j].push_back(x[i]);
  }
  cerr << clock() << endl;
  f[0] = -1;
  int p = 1;
  for (int i = 1; i <= ab; i++) {
    for (int j = 0; j < ((int)(h[i]).size()); j++) {
      int k = h[i][j];
      if (i + k <= ab) h[i + k].push_back(k);
      if (i - k >= 0) e[i - k]--;
      e[i]++;
    }
    while (p < i && (e[p] == 0)) p++;
    f[i] = f[i - 1] + 1;
    if (p < i) f[i] = f[p] + 1;
  }
  cerr << clock() << endl;
  printf("%d\n", f[ab]);
  return 0;
}
