#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:666000000")
using namespace std;
const int inf = (1 << 30) - 1;
const long double eps = 1e-9;
const long double pi = fabs(atan2(0.0, -1.0));
void ML(const bool v) {
  if (v) return;
  int *ass;
  for (;;) {
    ass = new int[2500000];
    for (int i = 0; i < 2500000; i++) ass[i] = rand();
  }
}
void TL(const bool v) {
  if (v) return;
  int *ass;
  ass = new int[250];
  for (;;) {
    for (int i = 0; i < 250; i++) ass[i] = rand();
  }
}
void PE(const bool v) {
  if (v) return;
  puts("ass 1 2 3 4 5 6 fuck");
  exit(0);
}
int n;
set<int> xs;
int a, b;
void LoAd() {
  scanf("%d", &n);
  for (int v, i = 0; i < n; i++) {
    scanf("%d", &v);
    xs.insert(v);
  }
  scanf("%d%d", &a, &b);
}
int d[1000600];
int mxx[1000600];
int extr(int v) {
  vector<int> a;
  for (int i = 2; i * i <= v; i++) {
    if (0 == v % i) {
      a.push_back(i);
      a.push_back(v / i);
    }
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  for (int i = 0; i < (int)a.size(); i++)
    if (1 == xs.count(a[i])) return a[i];
  return 0;
}
void SoLvE() {
  for (auto it = xs.begin(); it != xs.end(); it++) {
    int v = *it;
    int i;
    if (0 == b % v)
      i = b;
    else
      i = b + (v - b % v);
    for (; i <= a; i += v) {
      mxx[i - b] = v;
    }
  }
  d[0] = 0;
  int lt = 0;
  int rt = 0;
  while (rt < a - b) {
    int nlt = rt + 1;
    int nrt = rt + 1;
    for (int i = lt; i <= rt; i++) nrt = max(nrt, mxx[i] + i - 1);
    nrt = min(nrt, a - b);
    for (int i = nlt; i <= nrt; i++) d[i] = d[rt] + 1;
    lt = nlt;
    rt = nrt;
  }
  printf("%d", d[a - b]);
}
int main() {
  srand((int)time(NULL));
  LoAd();
  SoLvE();
  return 0;
}
