We will derive a general formula for the number of regions. Let the three sets have the number of elements ∣X∣=x, ∣Y∣=y and ∣Z∣=z, respectively. The first two divide the plane into a total of (x+1)(y+1) regions. Each line of the third set intersects the others at x+y points and is divided into x+y+1 parts. Each of them divides one of the already obtained areas into two. Thus we get a general formula:
Sx,y,z=(x+1)(y+1)+z(x+y+1)=x+y+z+xy+xz+yz+1.
We note that n=x+y+z. Furthermore, we have that 3(xy+yz+zx)≤(x+y+z)2=n2 (equivalent to (x−y)2+(y−z)2+(z−x)2≥0). So Sx,y,z≤n2/3+n+1 which is less than 128 for n=18 (actually, S6,6,6=127, i.e. S18=127). Also, S6,6,7=140, so Sn>128 for n≥19. Therefore, the answer is 18. □