#include <bits/stdc++.h>
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;
using namespace std;
int dp[MAXN], x[MAXN], a = 0, b = 0, m = 0;
int main() {
  scanf("%d", &(m));
  for (int i = 0; i < (m); i++) scanf("%d", &(x[i]));
  scanf("%d", &(a)), scanf("%d", &(b));
  sort(x, x + m);
  m = unique(x, x + m) - x;
  int cnt = 0;
  while (a != b) {
    cnt++;
    int nx = a - 1;
    for (int i = 0; i < m; i++) {
      while (m > 0 && a - a % x[i] < b) x[i] = x[m-- - 1];
      if (a - a % x[i] < nx && a - a % x[i] >= b) nx = a - a % x[i];
    }
    a = nx;
  }
  printf("%d\n", (cnt));
  return 0;
}
