12. Answer 76.
Let ∣S∣⩾3,p1α1p2α2p3a3∈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,c2⩽c3⩽108. Thus q∣c1.
From (c2,c1)=1,(c2,p1α1p2α2p3a3)=1,{p1,p2,p3,q}={2,3,5,7},c2⩽108 we know c2 is a prime number 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.
Take 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.
Below we prove that S1 satisfies (i), (ii).
If p1α1p2α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, same as (1).
(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 take u=2 or 3, such that b=ur1. Then ur1∈S,(ur1,a)>1,(ur1,b)>1.
If r1r2=b, then take v=2,3,5, such that a=ur1,b=ur1, then vr1∈S1,(vr1,a)>1,(vr1,b)>1.
Therefore, 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: 2×3×11,2×3×13,5×7,7⋯ (2) do not belong to S.
Assume (2) numbers all belong to S. From (i) we know 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.
Thus d1,d2 are both primes greater than 10. From (ii) we know d1=d2⩾17. From (ii) we know there exists d3∈S, such that (7,d3)>1,(d2,d3)>1.
Thus, 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.