#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
const long long int LINF = 1LL * INF * INF;
const int MAXN = 1e5 + 10;
const int MAXM = 1e6 + 10;
priority_queue<int> pq;
vector<vector<int> > graph;
vector<int> A;
int tree[4 * MAXM];
int mxf[MAXM];
char S[MAXN];
int mysearch(int L, int R) {
  int ans = INF;
  while (L <= R) {
    if (L % 2) ans = min(ans, tree[L]);
    if (!(R % 2)) ans = min(ans, tree[R]);
    L++;
    R--;
    L /= 2;
    R /= 2;
  }
  return ans;
}
void update(int tmp, int v) {
  tree[tmp] = v;
  tmp /= 2;
  while (tmp) {
    tree[tmp] = min(tree[tmp * 2], tree[tmp * 2 + 1]);
    tmp /= 2;
  }
  return;
}
int main() {
  int n, m, k, a, b, x, y;
  int sum = 0;
  int cnt = 0;
  scanf("%d", &n);
  A = vector<int>(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &A[i]);
  }
  scanf("%d%d", &a, &b);
  sort(A.begin(), A.end());
  A.erase(unique(A.begin(), A.end()), A.end());
  int num = a - b;
  for (int i = 0; i < A.size(); i++) {
    for (long long int j = A[i] - (b - 1 + A[i]) % A[i] - 1; j < num;
         j += (long long int)A[i])
      mxf[j] = A[i];
  }
  int base = 1;
  for (; base <= num; base *= 2)
    ;
  for (int i = base + num + 1; i < base * 2; i++) tree[i] = INF;
  for (int i = base - 1; i >= 1; i--)
    tree[i] = min(tree[i * 2], tree[i * 2 + 1]);
  tree[base + num] = 0;
  for (int i = num - 1; i >= 0; i--) {
    tree[i + base] =
        mysearch(base + i + 1, min(base + i + mxf[i], base + num + 1) - 1) + 1;
    tree[i + base] = min(tree[i + base + 1] + 1, tree[i + base]);
    update(i + base, tree[i + base]);
  }
  printf("%d", tree[base]);
  return 0;
}
