#include <bits/stdc++.h>
using namespace std;
int n, a, b, x[100005], dp[1000005];
vector<int> go[1000005];
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;
  scanf("%d%d", &b, &a);
  dp[0] = 0;
  deque<pair<int, int> > u;
  int rhs = 1;
  for (int i = 0; i < n; i++) {
    if (a % x[i] == 0) rhs = max(rhs, x[i] - 1);
    if (x[i] - a % x[i] < b - a) go[x[i] - a % x[i]].push_back(i);
  }
  u.push_back(pair<int, int>(1, rhs));
  for (int i = 1; i <= b - a; i++) {
    while (u.front().second < i) u.pop_front();
    dp[i] = u.front().first;
    rhs = max(rhs, i + 1);
    for (size_t j = 0; j < go[i].size(); j++) {
      int t = go[i][j];
      rhs = max(rhs, i + x[t] - 1);
      int g = max((rhs - i) / x[t], 1);
      if (i + x[t] * g < b - a) go[i + x[t] * g].push_back(t);
    }
    go[i].clear();
    u.push_back(pair<int, int>(dp[i] + 1, rhs));
  }
  printf("%d\n", dp[b - a]);
}
