#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 12, inf = 1e9, mod = 1e9 + 7, LOG = 18;
int n, a, b, dp[maxn], x[maxn], mx[maxn];
deque<pair<int, int> > dq;
map<int, int> was;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  scanf("%d%d", &a, &b);
  for (int i = 1; i <= n; i++) {
    if (was[x[i]]) continue;
    was[x[i]] = 1;
    int cur = b / x[i] * x[i];
    while (cur <= a) {
      if (cur >= b) mx[cur - b] = max(mx[cur - b], x[i]);
      cur += x[i];
    }
  }
  dq.push_back(make_pair(0, 0));
  for (int i = 0; i <= a - b; i++) {
    mx[i] = max(mx[i] - 1, 1);
    dp[i] = dq.front().second;
    while (dq.back().second > dp[i] + 1) dq.pop_back();
    if (dq.back().first < i + mx[i])
      dq.push_back(make_pair(i + mx[i], dp[i] + 1));
    while (dq.front().first == i) dq.pop_front();
  }
  printf("%d", dp[a - b]);
}
