#include <bits/stdc++.h>
using namespace std;
const int N = (1 << 20) + 100;
struct Segment {
  int spath[N << 2];
  Segment() {
    for (int i = 0; i < (N << 2); i++) spath[i] = -1;
  }
  void insert(int h, int e, int he, int en, int sp, int p) {
    if (he == h && en == e) {
      spath[p] = (spath[p] == -1) ? sp : min(sp, spath[p]);
      return;
    }
    int mid = (h + e) / 2;
    if (he <= mid) insert(h, mid, he, min(mid, en), sp, (((p) << 1) + 1));
    if (en > mid)
      insert(mid + 1, e, max(mid + 1, he), en, sp, (((p) << 1) + 2));
  }
  int query(int h, int e, int loc, int p) {
    if (h == e) {
      return spath[p];
    }
    int mid = (h + e) / 2;
    int sps = -1;
    if (loc <= mid) sps = query(h, mid, loc, (((p) << 1) + 1));
    if (loc > mid) sps = query(mid + 1, e, loc, (((p) << 1) + 2));
    if (sps == -1) return spath[p];
    if (spath[p] == -1) return sps;
    return min(spath[p], sps);
  }
} tree;
int mfac[N], a, b, n, x[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &x[i]);
  scanf("%d%d", &a, &b);
  for (int i = 0; i < N; i++) mfac[i] = -1;
  sort(x, x + n);
  n = unique(x, x + n) - x;
  for (int i = 0; i < n; i++) {
    int l = (b / x[i] * x[i]);
    for (int j = l; j <= a; j += x[i]) {
      if (j < b) continue;
      mfac[j - b] = max(mfac[j - b], x[i]);
    }
  }
  tree.insert(0, a - b, 0, 0, 0, 0);
  for (int i = 0; i < a - b; i++) {
    int s = tree.query(0, a - b, i, 0);
    int l = i + 1, r = i + 1;
    r = max(r, i + mfac[i] - 1);
    r = min(r, a - b);
    tree.insert(0, a - b, l, r, s + 1, 0);
  }
  printf("%d\n", tree.query(0, a - b, a - b, 0));
}
