#include <bits/stdc++.h>
using namespace std;
int n, a, b, dp[1000001], jmp[1000001];
vector<int> dv[1000001];
int main() {
  scanf("%d", &n);
  unordered_set<int> xs;
  for (int i = 0; i < n; i++) {
    int tmp;
    scanf("%d", &tmp);
    xs.insert(tmp);
  }
  scanf("%d%d", &a, &b);
  int num = a, ans = 0;
  while (num > b) {
    int nxt = num - 1;
    if (xs.empty()) {
      ans += num - b;
      break;
    }
    vector<int> xbad;
    for (int x : xs) {
      if (num / x * x >= b)
        nxt = min(nxt, num / x * x);
      else
        xbad.push_back(x);
    }
    for (int x : xbad) xs.erase(x);
    num = nxt;
    ans++;
  }
  printf("%d\n", ans);
}
