#include #include #include using namespace std; using ll = long long int; ll N, L, H; ll gcd(ll A, ll B) { return B ? gcd(B, A%B) : A; } ll lcm(ll A, ll B) { return A / gcd(A, B) * B; } ll solve(vector vec, ll val, ll M) { ll res = M / val; int sz = vec.size(); for(int bit=1; bit<(1<> i & 1) mul = lcm(mul, vec[i]); if(mul > M) goto OutOfLoop; } if(__builtin_popcount(bit) % 2) res -= M / mul; else res += M / mul; OutOfLoop:; } return res; } ll solve(vector vec, ll val) { return solve(vec, val, H) - solve(vec, val, L-1); } int main() { cin >> N >> L >> H; vector C(N); for(int i=0; i> C[i]; } ll ans = 0; for(int i=0; i D = C; ll val = D[i]; D.erase(D.begin() + i); ans += solve(D, val); } cout << ans << endl; return 0; }