#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using llu = unsigned long long;
int main() {
  ll t, n, m, i, j, k;
  cin >> n;
  ll a[n];
  unordered_map<ll, ll> z;
  for (i = 0; i < n; i++) cin >> a[i];
  m = 0;
  for (i = 0; i < n; i++) {
    if (z[a[i]] == 0) a[m++] = a[i];
    z[a[i]] = 1;
  }
  n = m;
  ll x, y;
  cin >> x >> y;
  ll ans = 0;
  while (x > y) {
    if (n == 0) {
      ans += x - y;
      break;
    }
    k = x - 1;
    for (i = 0; i < n; i++) {
      m = x - (x % a[i]);
      if (m >= y) k = min(k, m);
    }
    x = k;
    ans++;
    m = 0;
    for (i = 0; i < n; i++) {
      k = x - (x % a[i]);
      if (k >= y) a[m++] = a[i];
    }
    n = m;
  }
  cout << ans;
}
