N,X,Y,*A=$<.read.split.map &:to_i;s=0 (1<0&&(r=r.lcm A[j];d+=1)};s+=(Y/r-~-X/r)*~-d*(-1)**d} p s