#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int maxN = 1100000;
int n;
int x[101000];
int larg[maxN];
int res[maxN];
void getLargest(long long a, long long b) {
  int svalue = b;
  for (int i = 0; i < maxN; ++i) {
    larg[i] = 2;
  }
  for (int i = 0; i < n; ++i) {
    long long cur = x[i];
    long long mul = (b + cur - 1) / cur;
    for (long long val = mul * cur; val <= a; val += (long long)cur) {
      larg[val - b] = cur;
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x[i]);
  }
  sort(x, x + n);
  n = unique(x, x + n) - x;
  long long a, b;
  cin >> a >> b;
  getLargest(a, b);
  res[0] = 0;
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int t = q.front();
    int val = res[t];
    int mymax = t + larg[t] - 1;
    int cmax = t;
    while (!q.empty()) {
      int buf = q.front();
      q.pop();
      mymax = max(mymax, buf + larg[buf] - 1);
      cmax = max(cmax, buf);
    }
    for (int i = cmax + 1; i <= min(a - b, (long long)mymax); ++i) {
      res[i] = val + 1;
      q.push(i);
    }
  }
  cout << res[a - b] << endl;
  return 0;
}
