#include <bits/stdc++.h>
using namespace std;
int x[200000], dp[2000000], mx[2000000], dad[2000000], t;
set<int> S;
int main() {
  int n, a, b, now, sz = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    if (S.find(k) == S.end()) x[sz++] = k;
    S.insert(k);
  }
  n = sz;
  cin >> a >> b;
  t = a - b + 1;
  sort(x, x + n);
  for (int i = 0; i < t; i++) dad[i] = 2;
  for (int i = 0; i < n; i++)
    for (int j = (b + x[i] - 1) / x[i] * x[i] + -b; j < t; j += x[i])
      dad[j] = x[i];
  mx[0] = 1;
  now = 0;
  for (int i = 0; i < t; i++) {
    while (mx[now] <= i) now++;
    dp[i] = now;
    mx[now + 1] = max(mx[now + 1], i + dad[i]);
  }
  cout << dp[t - 1] << endl;
}
