#include <bits/stdc++.h>
using namespace std;
int n, a[200000], x, y, ans;
multimap<int, int> M;
pair<int, int> P;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= (n); ++i) scanf("%d", &a[i]);
  scanf("%d%d", &x, &y);
  sort(a + 1, a + n + 1);
  n = unique(a + 1, a + n + 1) - a - 1;
  for (int i = 1; i <= (n); ++i)
    if (x - x % a[i] >= y) M.insert(make_pair(x - x % a[i], a[i]));
  while (x > y) {
    if (M.empty()) {
      ans += x - y;
      break;
    }
    multimap<int, int>::iterator it = M.begin();
    if (it->first < x)
      x = it->first;
    else
      --x;
    ++ans;
    for (it = M.end(); !M.empty() && (--it)->first > x; it = M.end()) {
      P.first = x - x % it->second;
      P.second = it->second;
      M.erase(it);
      if (P.first >= y) M.insert(P);
    }
  }
  printf("%d\n", ans);
  return 0;
}
