#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
const int D = 2e6 + 1;
int a[N], m[D], M[D];
set<int> s;
int main() {
  int n, x, y;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x = i + 2;
    scanf("%d", &x);
    s.insert(x);
  }
  scanf("%d %d", &x, &y);
  n = 0;
  while (s.size()) {
    a[n++] = *s.begin();
    s.erase(s.begin());
  }
  for (int i = 0; i < n; i++) {
    int b = y / a[i] * a[i];
    for (int j = b; j <= x; j += a[i])
      if (j >= y) m[j - y] = a[i];
  }
  int end = y;
  for (int i = y; i <= x; i++) {
    end = max(end, i);
    if (m[i - y] && i + m[i - y] - 1 >= end)
      for (int j = end; j <= i + m[i - y] - 1 && j <= x; j++)
        M[j - y] = m[i - y], end++;
  }
  int ans = 0;
  while (x > y) {
    if (M[x - y] == 0 || x % M[x - y] == 0)
      x--;
    else
      x -= x % M[x - y];
    ans++;
  }
  printf("%d", ans);
}
