#include <bits/stdc++.h>
using namespace std;
using namespace std;
int n, k, a[((int)(1e5) + 5)], x, y, bol[((int)(1e6 + 5))],
    dp[((int)(1e6 + 5))], t, snr;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  cin >> x >> y;
  sort(a + 1, a + n + 1);
  n = unique(a + 1, a + n + 1) - a - 1;
  for (int i = y; i <= x; i++) bol[i - y + 1] = 2;
  for (int i = 1; i <= n; i++) {
    t = a[i];
    if (t < y)
      if (!(y % t))
        t = y;
      else
        t = ((y / t) + 1) * t;
    if (t > x) continue;
    for (; t <= x; t += a[i]) bol[t - y + 1] = a[i];
  }
  for (int i = y + 1; i <= x; i++) dp[i - y + 1] = ((int)(1e9 + 5));
  for (int i = y; i <= x - 1; i++) {
    t = -1;
    snr = min(x, i + bol[i - y + 1] - 1);
    for (int j = i + 1; j <= snr; j++) {
      if (t == -1 or j + bol[j - y + 1] >= t + bol[t - y + 1]) t = j;
      dp[j - y + 1] = min(dp[j - y + 1], dp[i - y + 1] + 1);
    }
    if (snr == x) break;
    i = t - 1;
  }
  cout << dp[x - y + 1] << '\n';
  return 0;
}
