#include #define M_PI 3.14159265358979323846 // pi using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector VI; typedef pair P; typedef tuple t3; typedef tuple t4; typedef tuple t5; #define rep(a,n) for(ll a = 0;a < n;a++) #define repi(a,b,n) for(ll a = b;a < n;a++) using namespace std; static const ll INF = 1e15; const ll mod = 1000000007; ll mpow(ll x, ll n) { ll ans = 1; x %= mod; while (n != 0) { if (n & 1) ans = ans * x % mod; x = x * x % mod; n = n >> 1; } return ans; } ll inv_mod(ll a) { return mpow(a, mod - 2); } class Factorial { private: vector fac; vector ifac; public: Factorial(ll N) { fac.push_back(1); for (int i = 0; i < N; i++) fac.push_back(fac[i] * (i + 1) % mod); ifac.resize(N + 1); ifac[N] = inv_mod(fac[N]); for (int i = 0; i < N; i++) ifac[N - 1 - i] = (ifac[N - i] * (N - i)) % mod; } ll fact(ll a) { return fac[a]; } ll ifact(ll a) { return ifac[a]; } ll cmb(ll a, ll b) { if (a == 0 && b == 0) return 1; if (a < b || a < 0 || b < 0) return 0; ll tmp = ifact(a - b) * ifact(b) % mod; return tmp * fac[a] % mod; } ll per(ll a, ll b) { if (a == 0 && b == 0) return 1; if (a < b || a < 0 || b < 0) return 0; return fac[a] * ifac[a - b] % mod; } }; ll gcd(ll a, ll b) { while (b) a %= b, swap(a, b); return abs(a); } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { ll n, l, h; cin >> n >> l >> h; vector cs(n); rep(i, n) cin >> cs[i]; vector state(1 << n, 0); rep(i, 1LL << n) { ll x = 1; rep(j, n) { if (i & (1LL << j)) { x = lcm(x, cs[j]); if (x > h) break; } } if (x > h) continue; ll div = h / x - (l - 1) / x; state[i] = div; } //1の場合 //1のみ + //1と2, 1 と3, ..., 1とn-1 - //1と2と3, 1 と3 と4, ..., + //を1,2,3と繰り返すため、__builtin_popcountllの数だけ加算される。 ll sum = 0; rep(i, 1LL << n) { auto p = __builtin_popcountll(i); ll s = p % 2 == 1 ? 1 : -1; sum += s * state[i] * p; } cout << sum << endl; return 0; }