5. The maximum possible number of elements in S is 76. Let ∣S∣⩾3,p1α1p2α2p3α3∈S,p1,p2,p3 be three different primes, p11,(c3,c2)>1. From (c1,c2)=1 we know the product of the smallest prime factors of c1 and c2 is ⩽c3⩽108. Thus, q∣c1. From (c2,c1)=1,(c2,p1q1p2σ2p3σ3)=1,{p1,p2,p3,q}={2,3,5,7},c2⩽108 we know c2 is a prime greater than 10. From (c3,c2)>1 we know c2∣c3. Also, 11,(c5,c4)>1. So c2∣c5,c4∣c5. From c2∣c3,(c4,c3)=1 we know (c2,c4)=1. Thus, c2c4∣c5. But c2c4⩾11×13>108, a contradiction. Let S1={1,2,⋯,108}\({1} and primes greater than 11 }∪{2×3×11,2×3×5,22×3×5,2×32×5,2×3×7,22×3×7,2×5×7,3×5×7}). Then ∣S1∣=76. We now prove that S1 satisfies (i) and (ii). If p1a1p2σ2p3σ3∈S1,p11, (2q1,b)>1; if b=3q1, then 3q1∈S1,(3q1,a)>1, (3q1,b)>1. (2) a=2×3×17,b=a, then (1) can be proven. (3) a=b, since at least one of 5,7,11 does not divide a, (i) holds. If a is composite, take the smallest prime factor p of a, then p∈S1,(p,a)>1; if a is prime, then a⩽11,2a∈S1,(2a,a)>1. (4) a,b are two different numbers in S1, a,b each contain at most two different prime factors, a1,(b,r1)>1; if r1=r2=a, then take u=2 or 3, such that b=ua. Then ua∈S,(ua,a)>1, (ua,b)>1; if r1r2=a,r1r2=b, then r1r2∈S1,(r1r2,a)>1,(r1r2,b)>1; if r1r2=a, then r11,(ur2,b)>1; if r1r2=b, then take v=2,3,5, such that a=vr1,b=vr1, then vr1∈S1,(vr1,a)>1,(vr1,b)>1. We have proven that Si satisfies (i) and (ii). On the other hand, it is clear that 2×3×5, 22×3×5, 2×32×5, 2×3×7, 22×3×7, 2×5×7, 3×5×7 do not belong to S. Now we prove that 2×3×11, 2×3×13, 5×7 do not all belong to S. Assume the contrary, that all three numbers belong to S. From (i) there exist d1,d2∈S such that (2×3×11,d1)=1,(5×7,d1)=1,(2×3×13,d2)=1,(5×7,d2)=1. Therefore, d1,d2 are both primes greater than 10. From (ii) we know d1=d2⩾17. From (ii) there exists d3∈S such that (7,d3)>1,(d2,d3)>1. Therefore, 7d2∣d3. But 7d2⩾7×17=119, a contradiction. On the other hand, among the primes greater than 10, at most one belongs to S, 1∈/S, thus ∣S∣⩽108−7−1−23−1=76.