#include #include using namespace std; using ll = long long; ll mygcd(ll a, ll b){ while(b != 0){ ll r = a%b; a = b; b = r; } return a; } int main(){ ll n, l, h; cin >> n >> l >> h; vector c(n); for(auto &it: c) cin >> it; auto calc = [&](ll x){ ll res = 0; for(int bit = 1; bit < (1 << n); bit++){ ll m = 1; int cnt = 0; bool iszero = false; for(int i = 0; i < n; i++){ if((bit >> i) & 1){ m *= c[i]/mygcd(m, c[i]); cnt++; if(m > x){ iszero = true; break; } } } if(!iszero){ if(cnt%2 == 0) res -= (x/m)*cnt; else res += (x/m)*cnt; } } return res; }; cout << calc(h)-calc(l-1) << endl; // cerr << calc(h) << " " << calc(l-1) << endl; return 0; }