#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int d[2000009], ata[2000009];
int main() {
  int n, x, a, b;
  scanf("%d", &n);
  vector<int> v;
  for (int i = 0; i < n; i++) scanf("%d", &x), v.push_back(x);
  scanf("%d%d", &a, &b);
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  fill(ata + 1, ata + (a - b) + 1, 2);
  fill(d + 1, d + 2000009, 1e9 + 7);
  for (int i = 0; i < v.size(); i++) {
    int k = v[i];
    if (k < b) {
      if (b % k == 0)
        k = b;
      else
        k = ((b / k) + 1) * k;
    }
    for (int j = k; j <= a; j += v[i]) ata[j - b + 1] = v[i];
  }
  d[1] = 0;
  for (int i = b; i < a; i++) {
    int k = min(a, i + ata[i - b + 1] - 1), mx = -1;
    for (int j = i + 1; j <= k; j++) {
      if (mx == -1 or j + ata[j - b + 1] >= mx + ata[mx - b + 1]) mx = j;
      umin(d[j - b + 1], d[i - b + 1] + 1);
    }
    if (k == a) break;
    i = mx - 1;
  }
  printf("%d\n", d[a - b + 1]);
  return 0;
}
