#include <bits/stdc++.h>
int n, a, b, x[100010], ans, nxt[100010], pre[100010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", x + i);
  scanf("%d%d", &a, &b);
  std::sort(x + 1, x + n + 1, std::greater<int>());
  n = std::unique(x + 1, x + n + 1) - x - 1;
  for (int i = 1; i <= n; i++) nxt[i - 1] = i, pre[i] = i - 1;
  while (a != b && nxt[0]) {
    int maxi = 1;
    for (int i = nxt[0]; i; i = nxt[i])
      if (a <= ((b % x[i]) ? b - b % x[i] + x[i] : b)) {
        nxt[pre[i]] = nxt[i];
        pre[nxt[i]] = pre[i];
      } else if (a % x[i] > maxi)
        maxi = a % x[i];
    ans++;
    a -= maxi;
  }
  printf("%d", ans + (a - b));
  return 0;
}
