# coding: utf-8 import array, bisect, collections, copy, heapq, itertools, math, random, re, string, sys, time sys.setrecursionlimit(10 ** 7) INF = 10 ** 20 MOD = 10 ** 9 + 7 def II(): return int(input()) def ILI(): return list(map(int, input().split())) def IAI(LINE): return [ILI() for __ in range(LINE)] def IDI(): return {key: value for key, value in ILI()} def read(): N, L, H = ILI() C = ILI() return N, L, H, C def calc_div(low, high, div_num): low_div, low_mod = divmod(low, div_num) high_div = high // div_num if low_mod != 0: low_div += 1 return high_div - low_div + 1 def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): return a * b // gcd (a, b) def l_lcm(list): if len(list) == 0: return 0 elif len(list) == 1: return list[0] elif len(list) == 2: return lcm(list[0], list[1]) else: ret_lcm = lcm(list[0], list[1]) for i in range(2, len(list)): ret_lcm = lcm(ret_lcm, list[i]) return ret_lcm def solve(N, L, H, C): ans = 0 comb_num = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10] for i in range(1, N + 1): sum_div_num = 0 for comb in itertools.combinations(C, i): comb_lcm = l_lcm(comb) div_num = calc_div(L, H, comb_lcm) sum_div_num += div_num ans += sum_div_num * comb_num[i - 1] return ans def main(): params = read() print(solve(*params)) if __name__ == "__main__": main()