#include <bits/stdc++.h>
using namespace std;
int max(int x, int y) { return x > y ? x : y; }
int num[100005], vis[100005];
int main() {
  int i, a, b, cnt, n, MAX, nu;
  while (scanf("%d", &n) != EOF) {
    memset(vis, 0, sizeof(vis));
    for (i = 0; i < n; i++) scanf("%d", num + i);
    sort(num, num + n);
    n = unique(num, num + n) - num;
    scanf("%d%d", &a, &b);
    cnt = 0;
    while (a != b) {
      MAX = 0;
      for (i = 0; i < n; i++) {
        while (a - a % num[i] < b && i < n) {
          num[i] = num[--n];
        }
        if (a - a % num[i] >= b) MAX = max(a % num[i], MAX);
      }
      if (MAX)
        a -= MAX;
      else
        a -= 1;
      cnt++;
    }
    printf("%d\n", cnt);
  }
}
