#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.);
const double eps = 1e-6;
bool bl[110000];
int n, A, B, a[110000], b[110000];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  sort(a, a + n);
  n = unique(a, a + n) - a;
  scanf("%d%d", &A, &B);
  int all = 0, tim = 0;
  while (A > B) {
    int best = 1000000000 + 100000;
    tim++;
    for (int i = 0; i < n; i++) {
      if (A - A % a[i] >= B && A - A % a[i] < best) best = A - A % a[i];
      if (A - A % a[i] < B) bl[i] = 1;
    }
    int h = 0;
    for (int i = 0; i < n; i++)
      if (!bl[i]) b[h++] = a[i];
    n = h;
    for (int i = 0; i < n; i++) a[i] = b[i];
    if (A == best) best--;
    if (n == 0) break;
    A = best;
    all++;
  }
  printf("%d\n", A - B + all);
}
