import java.util.*; public class Main { static final int MAX = 1000000007; public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long left = sc.nextInt(); long right = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } int[] lcms = new int[1 << n]; lcms[0] = 1; long total = 0; for (int i = 1; i < (1 << n); i++) { int pop = getPopcount(i); for (int j = 0; j < n; j++) { if ((i & (1 << j)) != (1 << j)) { continue; } lcms[i] = getLCM(lcms[i ^ (1 << j)], arr[j]); break; } if (pop % 2 == 0) { total -= (right / lcms[i] - (left - 1) / lcms[i]) * pop; } else { total += (right / lcms[i] - (left - 1) / lcms[i]) * pop; } } System.out.println(total); } static int getLCM(int x, int y) { int gcd = getGCD(x, y); if ((long)x / gcd * y >= MAX) { return MAX; } else { return x / gcd * y; } } static int getGCD(int x, int y) { if (x % y == 0) { return y; } else { return getGCD(y, x % y); } } static int getPopcount(int x) { int count = 0; while(x > 0) { count += x % 2; x /= 2; } return count; } }