#include <bits/stdc++.h>
using namespace std;
int v[1000100], m[100100], q[1000100], h[1000100], e[13000000];
int main() {
  int n, i, j, l, k, a, b;
  for (scanf("%d", &n), i = 0; i < n; scanf("%d", &m[i]), i++)
    ;
  scanf("%d%d", &b, &a);
  sort(m, m + n);
  n = unique(m, m + n) - m;
  k = b - a + 1;
  for (i = 0; i < n; i++) {
    if (a % m[i] == 0)
      j = 0;
    else
      j = m[i] - a % m[i];
    for (; j < k; h[j]++, j += m[i])
      ;
  }
  for (i = 0; i < k; h[i + 1] += h[i], i++)
    ;
  for (i = 0; i < n; i++) {
    if (a % m[i] == 0)
      j = 0;
    else
      j = m[i] - a % m[i];
    for (; j < k; e[--h[j]] = j - m[i], j += m[i])
      ;
  }
  b = 0;
  for (i = 0; i < k - 1; i++) {
    q[i] = b;
    v[b + 1] += h[i + 1] - h[i];
    for (j = h[i + 1]; j < h[i + 2]; j++)
      if (e[j] >= 0) --v[q[e[j]] + 1];
    if (!v[b]) b++;
  }
  printf("%d\n", b);
  return 0;
}
