#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define MT make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)<; using vi = vector; using vll = vector; const ll INF = (int)1e9 + 1; long long gcd(long long a, long long b) { return b ? gcd(b, a%b) : a; } long long lcm(long long a, long long b) { return a*b / gcd(a, b); } ll LCM[1 << 10], dp[1 << 10]; ll calc(int N, int H) { for (int S = (1 << N) - 1; S > 0; --S) { dp[S] = H / LCM[S]; FOR(T, S + 1, 1 << N) { if ((S&T) == S) { dp[S] -= dp[T]; } } } ll res = 0; rep(i, N)res += dp[1ll << i]; return res; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int N, L, H; cin >> N >> L >> H; vi C(N); rep(i, N)cin >> C[i]; rep(i, 1 << N) { ll l = 1; rep(j, N) if(i>>j&1){ l = lcm(l, C[j]); smin(l, INF); } LCM[i] = l; } cout << calc(N, H) - calc(N, L - 1) << endl; }