#include using namespace std; using i64 = int64_t; using vi = vector; using vvi = vector; i64 lcm(i64 a, i64 b) { return a / __gcd(a, b) * b; } void moebius(vi& ss) { int N = ss.size(); int n = 0; while (N > 1) { n++; N >>= 1; } for (int i = 0; i < n; i++) { for (int j = 0; j < (1 << n); j++) { if (!(j & (1 << i))) { ss[j] -= ss[j | (1 << i)]; } } } } int main() { i64 n, l, h; cin >> n >> l >> h; vi as(n); for (int i = 0; i < n; i++) { cin >> as[i]; } vi cnt(1 << n); for (int i = 0; i < (1 << n); i++) { i64 m = 1; for (int j = 0; j < n; j++) { if ((i >> j) & 1) { m = lcm(m, as[j]); } } cnt[i] = h / m - (l - 1) / m; } moebius(cnt); i64 ans = 0; for (int i = 0; i < (1 << n); i++) { if (__builtin_popcount(i) == 1) { ans += cnt[i]; } } cout << ans << endl; }