#include using namespace std; template T gcd(T a, T b) { while (b) { T tmp = b; b = a % b; a = tmp; } return a; } template T lcm(T a, T b) { return a / gcd(a, b) * b; } int main() { int64_t n, a, b; cin >> n >> a >> b; int64_t c[n]; for (auto &i : c) { cin >> i; } auto f = [&](int64_t x) { int64_t ans = 0; for (int i = 1; i < (1 << n); i++) { int64_t l = 1, count = 0; for (int j = 0; j < n; j++) { if ((i >> j) & 1) { l = lcm(l, c[j]); count++; if (x < l) { goto next; } } } ans += count * max(int64_t(0), x / l) * pow(-1, count + 1); next:; } return ans; }; cout << f(b) - f(a - 1) << endl; return 0; }