#include <bits/stdc++.h>
using namespace std;
int a, b;
int num[100001];
int n;
int k;
int ttime;
int znum[100001];
int compute(int m) {
  int largest = 0;
  for (int i = 1; i <= k; i++) {
    if (m - m % num[i] < a) {
      swap(num[i], num[k]);
      k--;
      i--;
    } else {
      if (largest < m % num[i]) largest = m % num[i];
    }
  }
  if (largest != 0)
    return m - largest;
  else
    return m - 1;
}
int main() {
  ttime = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> num[i];
  cin >> b >> a;
  sort(num + 1, num + n + 1);
  k = 1;
  for (int i = 1; i <= n - 1; i++) {
    if (num[i + 1] != num[i]) {
      k++;
      num[k] = num[i + 1];
    }
  }
  if (b == a) {
    cout << "0" << endl;
    return 0;
  }
  do {
    ttime++;
    b = compute(b);
  } while (b != a);
  cout << ttime << endl;
  return 0;
}
