#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int MAXN = 1e6 + 10;
int pri[MAXN];
struct SGtree {
  int a[MAXN << 2];
  void build(int idx, int l, int r) {
    a[idx] = 1LL << 30;
    if (l == r) return;
    build(idx << 1, l, (l + r) / 2);
    build(idx << 1 | 1, (l + r) / 2 + 1, r);
  }
  void update(int idx, int l, int r, int p, int v) {
    if (l == r) {
      a[idx] = v;
      return;
    }
    if (p <= (l + r) / 2)
      update(idx << 1, l, (l + r) / 2, p, v);
    else
      update(idx << 1 | 1, (l + r) / 2 + 1, r, p, v);
    a[idx] = min(a[idx << 1], a[idx << 1 | 1]);
  }
  int query(int idx, int l, int r, int x, int y) {
    if (x <= l && r <= y) return a[idx];
    int ans = 1LL << 30;
    if (x <= (l + r) / 2) ans = query(idx << 1, l, (l + r) / 2, x, y);
    if (y > (l + r) / 2)
      ans = min(ans, query(idx << 1 | 1, (l + r) / 2 + 1, r, x, y));
    return ans;
  }
} sg;
int dpp[MAXN];
int x[100000 + 10];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d", x + i);
  sort(x, x + n);
  n = unique(x, x + n) - x;
  int a, b;
  cin >> a >> b;
  for (int i = 0; i < n; i++) {
    int v = x[i];
    int s = b + (v - b % v);
    if (b % v == 0) s -= v;
    for (int j = s; j <= a; j += v) pri[j - b] = max(pri[j - b], v);
  }
  int l = a - b + 1;
  sg.build(1, 1, l);
  sg.update(1, 1, l, l, 0);
  int id = l - 1;
  for (int i = a - 1; i >= b; i--) {
    int dp = sg.query(1, 1, l, id + 1, id + 1) + 1;
    if (pri[i - b] != 0) {
      dp = min(dp, sg.query(1, 1, l, id + 1, min(id + pri[i - b] - 1, l)) + 1);
    }
    sg.update(1, 1, l, id, dp);
    id--;
  }
  cout << sg.query(1, 1, l, 1, 1) << endl;
  return 0;
}
