import java.io.*; import java.util.StringTokenizer; /** * Date: 2025/1/22 14:14 */ public class Main { public static void main(String[] args) { int n = sc.nextInt(), l = sc.nextInt(), r = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } long ans = f(a, n, r) - f(a, n, l - 1); out.println(ans); out.close(); } static long f(int[] a, int n, int t) { long ans = 0; for (int s = 1; s < 1 << n; s++) { int bit = Integer.bitCount(s); long v = 1; for (int i = 0; i < n; i++) { if ((s >> i & 1) == 1) v = getLCM(v, a[i]); } if (bit % 2 == 1) { ans += bit * (t / v); } else { ans -= bit * (t / v); } } return ans; } //求 a 和 b 的最大公约数,做法:辗转相除法 static long getGCD(long a, long b) { if (b == 0) return a; if (a % b == 0) return b; return getGCD(b, a % b); } //求 a 和 b 的最小公倍数, lcm * gcd = a * b static long getLCM(long a, long b) { return a * b / getGCD(a, b); } static Kattio sc = new Kattio(); static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); static class Kattio { static BufferedReader r; static StringTokenizer st; public Kattio() { r = new BufferedReader(new InputStreamReader(System.in)); } public String next() { try { while (st == null || !st.hasMoreTokens()) { st = new StringTokenizer(r.readLine()); } return st.nextToken(); } catch (Exception e) { return null; } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } } }