n,l,h,*cc=$<.read.split.map(&:to_i) l-=1 p (1..n).reduce(0){|r,i|cc.combination(i){|v|e=v.inject(1){|s,x|s*x/s.gcd(x)} r+=(h/e-l/e)*(i.odd?? i:-i)};r}