#include <bits/stdc++.h>
using namespace std;
int x[100010];
int a, b, n;
int main() {
  while (cin >> n) {
    for (int i = 0; i < n; ++i) scanf("%d", x + i);
    scanf("%d%d", &a, &b);
    sort(x, x + n);
    n = unique(x, x + n) - x;
    int s = 0;
    if (a == b) {
      puts("0");
      continue;
    }
    while (a - b > 0) {
      if (!n) break;
      int dt = 1;
      for (int i = 0; i < n; ++i) {
        if (a - a % x[i] < b) {
          x[i--] = x[--n];
        } else
          dt = max(dt, a % x[i]);
      }
      a -= dt;
      s++;
    }
    cout << s + a - b << endl;
  }
  return 0;
}
