#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010, maxp = 1000010;
int x[maxn], dp[maxp][20], can[maxp], f[maxp];
int n, a, b;
inline void chkmax(int& a, int b) {
  if (a < b) a = b;
}
inline void chkmin(int& a, int b) {
  if (a > b) a = b;
}
int getmin(int l, int r) {
  int b;
  for (b = 0; l + (1 << b) < r - (1 << b) + 1; b++)
    ;
  return min(dp[l][b], dp[r - (1 << b) + 1][b]);
}
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", &a, &b);
  swap(a, b);
  for (int i = 0; i < n; i++) {
    int st = a - a % x[i];
    if (st != a) st += x[i];
    while (st <= b) {
      chkmax(can[st - a], x[i]);
      st += x[i];
    }
  }
  int length = b - a + 1;
  memset(f, 0x3f, sizeof f);
  dp[length - 1][0] = 0;
  f[length - 1] = 0;
  for (int i = length - 2; i >= 0; i--) {
    int pos = min(length - 1, i + can[i] - 1);
    if (can[i] > 1) chkmin(f[i], getmin(i + 1, pos) + 1);
    chkmin(f[i], f[i + 1] + 1);
    dp[i][0] = f[i];
    for (int j = 1; i + (1 << j) <= length; j++)
      dp[i][j] = min(dp[i][j - 1], dp[i + (1 << (j - 1))][j - 1]);
  }
  printf("%d\n", f[0]);
  return 0;
}
