#include <bits/stdc++.h>
using namespace std;
int n, m, k, a, b;
int x[100010];
bool cmp(int z, int y) { return z > y; }
set<int> myset;
set<int>::iterator p;
int main() {
  int i, j;
  while (cin >> n) {
    myset.clear();
    for (i = 1; i <= n; i++) scanf("%d", &j), myset.insert(j);
    cin >> a >> b;
    if (a == b) {
      puts("0");
      continue;
    }
    n = myset.size();
    i = 1;
    for (p = myset.begin(); p != myset.end(); p++, i++) x[i] = *p;
    sort(x + 1, x + 1 + n, cmp);
    int step = 0;
    int l = 1;
    while (x[l] > a && l <= n) l++;
    while (x[l] > (a >> 1) && (a - x[l]) > (a - b)) l++;
    if (l > n) {
      cout << a - b << endl;
      continue;
    }
    while (a != b) {
      step++;
      int now = 1, cha = a - b;
      for (i = l; i <= n; i++) {
        if (now >= x[i]) break;
        int tmp = a - ((a / x[i]) * x[i]);
        if (tmp <= now || tmp > cha) continue;
        now = tmp;
      }
      a -= now;
      while (x[l] > a && l <= n) l++;
      while (x[l] > (a >> 1) && (a - x[l]) > cha) l++;
      if (l > n) break;
    }
    cout << step + a - b << endl;
  }
  return 0;
}
