#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int inf = 0x3f3f3f3f;
int mi[N << 2];
int m;
void up(int x, int v) {
  mi[x += m] = v;
  for (x >>= 1; x; x >>= 1) mi[x] = min(mi[x << 1], mi[x << 1 | 1]);
}
int Q(int l, int r) {
  if (l > r) return inf;
  l += m - 1, r += m + 1;
  int ans = inf;
  for (; l ^ r ^ 1; l >>= 1, r >>= 1) {
    if (~l & 1) ans = min(ans, mi[l ^ 1]);
    if (r & 1) ans = min(ans, mi[r ^ 1]);
  }
  return ans;
}
int x[N];
int pre[N];
int a, b;
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;
  cin >> a >> b;
  int len = a - b + 1;
  for (m = 1; m < len + 2; m <<= 1)
    ;
  for (int i = 1; i < m + m; i++) mi[i] = inf;
  for (int i = 0; i < n; i++)
    for (int j = ((b - 1) / x[i] + 1) * x[i]; j <= a; j += x[i])
      pre[j - b + 1] = max(pre[j - b + 1], x[i]);
  up(len, 0);
  for (int i = a - 1; i >= b; i--) {
    int id = i - b + 1;
    int mod = min(mi[id + m + 1], Q(id + 1, min(len, id + pre[id] - 1)));
    up(id, mod + 1);
  }
  cout << mi[1 + m] << endl;
  return 0;
}
