from collections import * import sys import heapq from heapq import heapify, heappop, heappush import bisect from bisect import bisect_left, bisect_right import itertools from functools import lru_cache from types import GeneratorType from fractions import Fraction import math import copy import random # import numpy as np # sys.setrecursionlimit(int(1e7)) # @lru_cache(maxsize=None) # CPython特化 # @bootstrap # PyPy特化(こっちのほうが速い) yield dfs(), yield Noneを忘れずに def bootstrap(f, stack=[]): # yield def wrappedfunc(*args, **kwargs): if stack: return f(*args, **kwargs) else: to = f(*args, **kwargs) while True: if type(to) is GeneratorType: stack.append(to) to = next(to) else: stack.pop() if not stack: break to = stack[-1].send(to) return to return wrappedfunc dxdy1 = ((0, 1), (0, -1), (1, 0), (-1, 0)) # 上下右左 dxdy2 = ( (0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (-1, -1), (1, -1), (-1, 1), ) # 8方向すべて dxdy3 = ((0, 1), (1, 0)) # 右 or 下 dxdy4 = ((1, 1), (1, -1), (-1, 1), (-1, -1)) # 斜め INF = float("inf") _INF = 1 << 60 MOD = 998244353 mod = 998244353 MOD2 = 10**9 + 7 mod2 = 10**9 + 7 # memo : len([a,b,...,z])==26 # memo : 2^20 >= 10^6 # 小数の計算を避ける : x/y -> (x*big)//y ex:big=10**9 # @:小さい文字, ~:大きい文字,None: 空の文字列 # ユークリッドの互除法:gcd(x,y)=gcd(x,y-x) # memo : d 桁以下の p 進表記を用いると p^d-1 以下のすべての # 非負整数を表現することができる # memo : (X,Y) -> (X+Y,X−Y) <=> 点を原点を中心に45度回転し、√2倍に拡大 # memo : (x,y)のx正から見た偏角をラジアンで(-πからπ]: math.atan2(y, x) # memo : a < bのとき ⌊a⌋ ≦ ⌊b⌋ input = lambda: sys.stdin.readline().rstrip() mi = lambda: map(int, input().split()) li = lambda: list(mi()) ii = lambda: int(input()) py = lambda: print("Yes") pn = lambda: print("No") pf = lambda: print("First") ps = lambda: print("Second") # 包助原理 O(2 ^ n) # |A1 ⋁ A2 ⋁ ... ⋁ An| = |Ai| - |Ai ⋀ Aj| + ... + (-1) ^ (n - 1)|A1 ⋀ ... ⋀ An| N, L, H = mi() C = li() ans = 0 for i in range(N): targ = C[i] CC = C[:i] + C[i + 1 :] tmp = 0 LCC = len(CC) for j in range(1 << LCC): use = [targ] for k in range(LCC): if (j >> k) & 1: use.append(CC[k]) lcm = math.lcm(*use) tmp += (-1) ** (len(use) - 1) * (H // lcm - (L - 1) // lcm) ans += tmp print(ans)