#include <bits/stdc++.h>
using namespace std;
int a[1000010], maxv[1000010], cost[1000010];
void lemon() {
  int n;
  scanf("%d", &n);
  for (int i = (1); i <= (n); i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  int n0 = 1;
  for (int i = (2); i <= (n); i++)
    if (a[i] != a[n0]) n0++, a[n0] = a[i];
  n = n0;
  int s, t;
  scanf("%d%d", &t, &s);
  int L = t - s;
  for (int i = (0); i <= (L); i++) maxv[i] = i + 1;
  for (int i = (1); i <= (n); i++) {
    int la = t - t % a[i];
    if (la >= s) maxv[la - s] = max(maxv[la - s], t - s);
    while (la >= s) {
      int da = la - a[i];
      if (da >= s) maxv[da - s] = max(maxv[da - s], la - 1 - s);
      la = da;
    }
  }
  for (int i = (0); i <= (L); i++) cost[i] = -1;
  cost[0] = 0;
  int cmax = 1;
  for (int i = (0); i <= (L); i++) {
    if (cost[i] == -1) {
      int val = cost[i - 1] + 1;
      for (int j = (i); j <= (cmax); j++) cost[j] = val;
    }
    cmax = max(cmax, maxv[i]);
  }
  cout << cost[L] << endl;
}
int main() {
  ios::sync_with_stdio(true);
  lemon();
  return 0;
}
