#include <bits/stdc++.h>
using namespace std;
const int MAX = (int)1e9;
int x[1000010], d[1000010], ma[1000010], an[1000010], a;
void fresh_ma(int &x, int v) {
  if (x < v) x = v;
}
void fresh_mi(int &x, int v) {
  if (x > v) x = v;
}
void insert(int x, int v) {
  if (!x) return;
  while (x < 1000010) {
    fresh_mi(d[x], v);
    x += x & -x;
  }
}
int qq(int x) {
  int res = MAX;
  while (x) {
    fresh_mi(res, d[x]);
    x -= x & -x;
  }
  return res;
}
int main() {
  int(n);
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) scanf("%d", &(x[i]));
  int a, b;
  scanf("%d%d", &a, &b);
  sort(x, x + n);
  n = unique(x, x + n) - x;
  for (int i = 0; i < (n); ++i) {
    int k = b / x[i] * x[i];
    if (k < b) k += x[i];
    while (k <= a) {
      fresh_ma(ma[k - b], x[i]);
      k += x[i];
    }
  }
  for (int i = 0; i < (1000010); ++i) d[i] = MAX;
  insert(a - b, an[a - b] = 0);
  for (int i = a - 1; i >= b; i--) {
    if (ma[i - b] == 0)
      an[i - b] = an[i + 1 - b] + 1;
    else {
      an[i - b] = qq(min(i + ma[i - b] - 1 - b, 1000010 - 1)) + 1;
    }
    insert(i - b, an[i - b]);
  }
  printf("%d\n", an[0]);
  return 0;
}
