#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include #include #include #include #include //#include //using namespace atcoder; using namespace std; using i32 = int_fast32_t; using i64 = int_fast64_t; using usize = size_t; using u32 = uint_fast32_t; using u64 = uint_fast64_t; using i128 = __int128_t; using u128 = __uint128_t; template using vec = vector; #define rep(i, n) for (i64 i = 0; i < (i64)(n); ++i) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() #define len(hoge) (i64)((hoge).size()) using P = pair; void solve(){ } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); i64 n,l,h; cin >> n >> l >> h; l--; i64 H = 0,L = 0; array a; rep(i,n)cin >> a[i]; for(i32 bit = 1; bit < (1 << n); bit++){ i64 mul = 1; rep(i,n){ if(bit & (1 << i)){ mul = lcm(mul,a[i]); } } i64 cnt = __builtin_popcount(bit); if(cnt % 2)H += h / mul * cnt; else H -= h / mul * cnt; } for(i32 bit = 1; bit < (1 << n); bit++){ i64 mul = 1; rep(i,n){ if(bit & (1 << i)){ mul = lcm(mul,a[i]); } } i64 cnt = __builtin_popcount(bit); if(cnt % 2)L += l / mul * cnt; else L -= l / mul * cnt; } cout << H - L << endl; }