#include using namespace std; using ll = long long; ll lcm(ll x, ll y) { return x / __gcd(x, y) * y; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; ll L, H; cin >> n >> L >> H; vector c(n); for (int i = 0; i < n; i++) cin >> c[i]; ll ans = 0; for (int i = 1; i < (1 << n); i++) { int cnt = 0; ll tmp = 1; for (int j = 0; j < n; j++) { if (i & (1 << j)) { cnt++; tmp = lcm(tmp, c[j]); } } if (cnt % 2 == 1) ans += (H / tmp - (L - 1) / tmp) * cnt; else ans -= (H / tmp - (L - 1) / tmp) * cnt; } cout << ans << endl; return 0; }