#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long gcd(long long a, long long b){ while(b != 0){ long long tmp = a % b; a = b; b = tmp; } return a; } long long lcm(long long a, long long b){ return a / gcd(a, b) * b; } long long solve(const vector& c, int limit) { int n = c.size(); long long ans = 0; for(int i=1; i<(1< bs(i); long long x = 1; for(int j=0; j limit){ x = -1; break; } } if(x != -1){ int m = bs.count(); if(m % 2 == 1) ans += limit / x * m; else ans -= limit / x * m; } } return ans; } int main() { int n, l, h; cin >> n >> l >> h; vector c(n); for(int i=0; i> c[i]; long long ans = solve(c, h) - solve(c, l-1); cout << ans << endl; return 0; }