#include <bits/stdc++.h>
using namespace std;
int value[(1 << 17)], ant[(1 << 17)], st[(1 << 17)], sp;
const int maxn = 1e6 + 47;
int f[maxn], adj[maxn], first[100001], a, b, n;
int main() {
  if (true) cin.sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < int(n); ++i) cin >> first[i];
  sort(first, first + n);
  n = unique(first, first + n) - first;
  reverse(first, first + n);
  cin >> a >> b;
  memset(adj, -1, sizeof adj);
  for (int i = 0; i < int((1 << 17)); ++i) st[sp++] = i;
  for (int i = 0; i < n; i++) {
    int bb = b;
    if (bb % first[i]) bb -= bb % first[i], bb += first[i];
    if (bb <= a) do {
        int m = st[--sp];
        value[m] = first[i], ant[m] = adj[bb - b], adj[bb - b] = m;
      } while (false);
  }
  for (int i = 0; i < int(maxn); ++i) f[i] = i;
  for (int pos = b, last = b; pos <= a; pos++) {
    int &at = f[pos - b];
    at = min(at, f[pos - b - 1] + 1);
    for (int e = adj[pos - b]; e >= 0; e = ant[e]) {
      int dx = value[e];
      int ini = pos + 1, fim = min(pos + dx, a + 1);
      for (last = max(last, ini); last < fim; last++) {
        f[last - b] = at + 1;
      }
      if (pos + dx <= a) {
        do {
          int m = st[--sp];
          value[m] = dx, ant[m] = adj[pos + dx - b], adj[pos + dx - b] = m;
        } while (false);
      }
    }
    for (int e = adj[pos - b]; e >= 0; e = ant[e]) st[sp++] = e;
  }
  cout << f[a - b] << endl;
  return 0;
}
