#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector veci; typedef vector vecll; typedef vector vecs; template using Hash=unordered_map; #define REP(i, a, n) for(ll i = a; i < (ll)n; i++) #define RREP(i, a, n) for(ll i = n-1; i >= (ll)a; i--) #define rep(i, n) REP(i, 0, n) #define rrep(i, n) RREP(i, 0, n) #define MD 1000000007 template T read(){T a;cin >> a;return a;} template void read(T& a){cin >> a;} template void read(T& a, Args&... args){cin >> a; read(args...);} template void rarr(T a, int n){for(int i = 0; i < n; i++) {cin >> a[i];}} template void write(T a){cout << fixed << setprecision(4) << a << endl;} template void write(T a, Args... args){cout << fixed << setprecision(4) << a << c; write(args...);} template void warr(vector a, const char* c = " "){cout << a[0];for(int i = 1; i < (int)a.size(); i++)cout << c << a[i];cout << endl;;} template void warr(T a, int n, const char* c = " "){cout << a[0];for(int i = 1; i < n; i++)cout << c << a[i];cout << endl;} void split(string s, string delim, veci& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(atoi(s.substr(pos).data()));break;}else {result.push_back(atoi(s.substr(pos, p - pos).data()));}pos = p + delim.size();}} void split(string s, string delim, vecs& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(s.substr(pos));break;}else {result.push_back(s.substr(pos, p - pos));}pos = p + delim.size();}} ull gcd(ull a, ull b){while(true){ull k = a % b;if(k == 0)return b;a = b;b = k;}} ull lcm(ull a, ull b){return a*b/gcd(a,b);} ull comb(ull n, ull m){ull p=1;m=min(m,n-m);for(ull i=1;i<=m;i++){p*=n-i+1;p/=i;}return p;} template void parted_rotate(FI first1, FI last1, FI first2, FI last2) { if(first1 == last1 || first2 == last2) return; FI next = first2; while (first1 != next) { std::iter_swap(first1++, next++); if(first1 == last1) first1 = first2; if (next == last2) { next = first2; } else if (first1 == first2) { first2 = next; } } } template bool next_combination_imp(BI first1, BI last1, BI first2, BI last2) { if(first1 == last1 || first2 == last2) return false; auto target = last1; --target; auto last_elem = last2; --last_elem; // find right-most incrementable element: target while(target != first1 && !(*target < *last_elem)) --target; if(target == first1 && !(*target < *last_elem)) { parted_rotate(first1, last1, first2, last2); return false; } // find the next value to be incremented: *next auto next = first2; while(!(*target < *next)) ++next; std::iter_swap(target++, next++); parted_rotate(target, last1, next, last2); return true; } // INVARIANT: is_sorted(first, mid) && is_sorted(mid, last) template inline bool next_combination(BI first, BI mid, BI last) { return next_combination_imp(first, mid, mid, last); } // INVARIANT: is_sorted(first, mid) && is_sorted(mid, last) template inline bool prev_combination(BI first, BI mid, BI last) { return next_combination_imp(mid, last, first, mid); } int n,l,h; ll c[10]; ll run(int d){ ll res=0; //rep(i,n)res+=d/c[i]; int sign=1; REP(i,1,n+1){ ll t[10]; rep(j,n)t[j]=c[j]; while(true){ ll p=1; rep(j,i){ p=lcm(p,t[j]); if(p>d)break; } res+=d/p*sign*i; if(!next_combination(t,t+i,t+n))break; } sign*=-1; } //write(res); return res; } int main(void) { read(n,l,h); rep(i,n)read(c[i]); sort(c,c+n); ll res=0; res+=run(h); res-=run(l-1); write(res); return 0; }