n, lo, hi = read_line.split.map &.to_i64 c = read_line.split.map &.to_i64 ans = (1...1 << n).sum { |mask| l = (0...n) .select { |i| mask.bit(i) == 1 } .to_a.reduce(1_i64) { |acc, i| {acc.lcm(c[i]), hi + 1}.min } cnt = hi // l - (lo - 1) // l k = mask.popcount.to_i64 k.odd? ? k*cnt : -k*cnt } puts ans