#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000001;
class SegmentTree {
 public:
  vector<int> tree;
  int size;
  SegmentTree() {}
  SegmentTree(vector<int>& a) : size((int)a.size()) {
    int pow2 = 1;
    while (pow2 < (int)a.size()) {
      pow2 *= 2;
    }
    while ((int)a.size() < pow2) {
      a.push_back(INF);
    }
    tree.resize(pow2 * 2);
    for (int v = pow2; v <= 2 * pow2 - 1; ++v) {
      tree[v] = a[v - pow2];
    }
    for (int v = pow2 - 1; v >= 1; --v) {
      tree[v] = min(tree[2 * v], tree[2 * v + 1]);
    }
    size = pow2;
  }
  int GetMin(int l, int r) { return GetMin(1, 0, size - 1, l, r); }
  int GetMin(int v, int tl, int tr, int l, int r) {
    if (l == tl && r == tr) {
      return tree[v];
    }
    int tm = (tl + tr) / 2;
    if (r <= tm) {
      return GetMin(2 * v, tl, tm, l, r);
    } else if (l >= tm + 1) {
      return GetMin(2 * v + 1, tm + 1, tr, l, r);
    } else {
      return min(GetMin(2 * v, tl, tm, l, tm),
                 GetMin(2 * v + 1, tm + 1, tr, tm + 1, r));
    }
  }
  void Modify(int pos, int newValue) {
    return Modify(1, 0, size - 1, pos, newValue);
  }
  void Modify(int v, int tl, int tr, int pos, int newValue) {
    if (tl == tr) {
      tree[v] = newValue;
    } else {
      int tm = (tl + tr) / 2;
      if (pos <= tm) {
        Modify(2 * v, tl, tm, pos, newValue);
      } else {
        Modify(2 * v + 1, tm + 1, tr, pos, newValue);
      }
      tree[v] = min(tree[2 * v], tree[2 * v + 1]);
    }
  }
};
int main() {
  int n;
  cin >> n;
  set<int> x;
  for (int i = 0; i < n; ++i) {
    int buf;
    cin >> buf;
    x.insert(buf);
  }
  int a;
  int b;
  cin >> a >> b;
  vector<int> d(a - b + 1, 1);
  for (set<int>::const_iterator it = x.begin(); it != x.end(); ++it) {
    int i;
    if (b % *it == 0) {
      i = 0;
    } else {
      i = *it - (b % *it);
    }
    for (; i <= a - b; i += *it) {
      d[i] = max(d[i], *it);
    }
  }
  vector<int> dp(a - b + 1, INF);
  dp[a - b] = 0;
  SegmentTree st(dp);
  int cnt = 0;
  for (int i = a - b - 1; i >= 0; --i) {
    if (d[i] == 1) {
      dp[i] = dp[i + 1] + 1;
      st.Modify(i, dp[i]);
      continue;
    }
    int l = i + 1;
    int r = min(a - b, d[i] + i - 1);
    dp[i] = st.GetMin(l, r) + 1;
    dp[i] = min(dp[i], dp[i]);
    st.Modify(i, dp[i]);
  }
  cout << dp[0] << endl;
  return 0;
}
