#include <bits/stdc++.h>
using namespace std;
const int SUP = int(1e6) + 5;
const int MAX = 100005;
int N, A, B, D;
int X[MAX];
int jump[SUP];
int T[SUP];
void put(int p, int v) {
  for (; p <= D; p += p & -p) T[p] = min(T[p], v);
}
int get(int p) {
  int ret = SUP;
  p = min(p, D);
  for (; p > 0; p -= p & -p) ret = min(ret, T[p]);
  return ret;
}
void add(int x) {
  int ini = (x - A % x) % x;
  for (int i = ini; i < D; i += x) jump[i] = max(jump[i], x - 1);
}
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) scanf("%d", X + i);
  scanf("%d%d", &B, &A);
  D = B - A;
  if (!D) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < D; i++) jump[i] = 1;
  sort(X, X + N);
  for (int i = 0; i < N; i++)
    if (i == 0 || X[i] != X[i - 1]) add(X[i]);
  for (int i = 0; i <= D; i++) T[i] = SUP;
  int ans = 0;
  put(D, 0);
  for (int p = D - 1; p >= 0; p--) {
    int tmp = get(p + jump[p]);
    if (p)
      put(p, 1 + tmp);
    else
      ans = 1 + tmp;
  }
  cout << ans << endl;
  return 0;
}
