#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int n, a, b;
int main() {
  scanf("%d", &n);
  v.resize(n);
  for (int i = 0; i < n; i++) scanf("%d", &v[i]);
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  while (!v.empty() && a - a % v.back() < b) v.pop_back();
  scanf("%d %d", &a, &b);
  int cur = a, res = 0;
  while (cur != b) {
    if (v.empty()) {
      res += cur - b;
      break;
    }
    int mx = 1;
    for (int i = 0; i < v.size(); i++) {
      int sub = cur % v[i];
      if (cur - sub < b) continue;
      mx = max(mx, sub);
    }
    cur -= mx;
    while (!v.empty() && cur - cur % v.back() < b) v.pop_back();
    res++;
  }
  printf("%d\n", res);
  return 0;
}
