#include <bits/stdc++.h>
#pragma comment(linker, "/stack:16777216")
using namespace std;
const int INF = 1000000000;
const int MAX = 1 << 17;
const int MAX2 = 1 << 20;
const int BASE = 1000000000;
int n, a, b, m;
int A[MAX];
int B[MAX];
int R[MAX2];
int M[MAX2];
int T[MAX2 * 4];
void Set(int j, int d, int i, int l, int r) {
  if (l == r)
    T[i] = min(T[i], d);
  else {
    int tm = (l + r) / 2;
    if (j <= tm)
      Set(j, d, i * 2, l, tm);
    else
      Set(j, d, i * 2 + 1, tm + 1, r);
    T[i] = min(T[i * 2], T[i * 2 + 1]);
  }
}
int Get(int l, int r, int i, int tl, int tr) {
  if (l == tl && r == tr) return T[i];
  int tm = (tl + tr) / 2;
  if (r <= tm) return Get(l, r, i * 2, tl, tm);
  if (l > tm) return Get(l, r, i * 2 + 1, tm + 1, tr);
  return min(Get(l, tm, i * 2, tl, tm), Get(tm + 1, r, i * 2 + 1, tm + 1, tr));
}
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); ++i) {
    scanf("%d", &A[i]);
  }
  scanf("%d %d", &a, &b);
  sort(A, A + n);
  m = 1;
  B[0] = A[0];
  for (int i = (1); i < (n); ++i)
    if (A[i] != A[i - 1]) B[m++] = A[i];
  for (int i = (0); i < (MAX2); ++i) M[i] = 1;
  for (int i = (0); i < (m); ++i) {
    int Min = b / B[i];
    if (b % B[i] != 0) ++Min;
    Min *= B[i];
    int Max = a / B[i];
    Max *= B[i];
    for (int j = Min; j <= Max; j += B[i])
      if (j >= b && j <= a) M[j - b] = max(M[j - b], B[i]);
  }
  for (int i = (0); i < (MAX2 * 4); ++i) T[i] = INF;
  int d = a - b;
  R[0] = 0;
  Set(0, 0, 1, 0, d);
  for (int i = (0); i < (d + 1); ++i) {
    R[i] = Get(i, d, 1, 0, d);
    Set(min(d, max(i + 1, i + M[i] - 1)), R[i] + 1, 1, 0, d);
  }
  printf("%d\n", R[d]);
  return 0;
}
