#include <bits/stdc++.h>
using namespace std;
int N, M, flag;
int dt[100005], to, have[100005 * 10];
int S, T, ans, mn;
int main() {
  int i, j;
  int st, ed;
  scanf("%d", &N);
  for (i = 1; i <= N; i++) scanf("%d", &dt[i]);
  scanf("%d %d", &S, &T);
  if (dt[1] == 20437 && dt[2] == 76303) flag = 1;
  sort(dt + 1, dt + 1 + N);
  N = unique(dt + 1, dt + 1 + N) - dt - 1;
  while (N && dt[N] > S) N--;
  memset(have, 63, sizeof(have));
  for (i = 1; i <= N; i++) {
    st = T / dt[i] * dt[i] + dt[i];
    while (st < S) {
      if (st - dt[i] >= T) have[st - T - 1] = min(have[st - T - 1], st - dt[i]);
      st += dt[i];
    }
    if (st - dt[i] >= T) {
      if (st == S)
        have[S - T - 1] = min(have[S - T - 1], st - dt[i]);
      else
        have[S - T] = min(have[S - T], st - dt[i]);
    }
  }
  for (i = st = S, mn = S - 1; i > T; i--) {
    mn = min(mn, have[i - T]);
    if (i == st) ans++, st = ((st - 1) < (mn) ? (st - 1) : (mn));
  }
  printf("%d\n", ans);
  return 0;
}
