3. When $n$ is odd, there does not exist a triply connected set; whereas for even numbers $n$ not less than 38, a triply connected set always exists. Therefore, between 2018 and 3018, there are 501 positive integers that satisfy the condition.

First, consider the number of intersections between two squares in a triply connected set.

Since each square intersects exactly with three other squares, $n$ squares have a total of $3n$ pairs of intersecting squares. However, each pair of intersecting squares is counted twice, so $3n$ must be even. Thus, $n$ must be even.

Next, consider the following two configurations: in each, the squares at the ends are connected to only two other squares, while the rest of the squares are connected to three other squares. See Figures 2 and 3. Note that the length of the first configuration can be arbitrarily extended.

By combining these two configurations into the image shown in Figure 4, for even numbers $n$ not less than 38, a triply connected set can always be obtained.
3. If $n$ squares in a plane satisfy:
(1) All squares are congruent;
(2) If two squares have a common intersection point $P$, then $P$ is a vertex of each of the squares;
(3) Each square intersects exactly three other squares, then this set of $n$ squares is called "triconnected."

Question: How many positive integers $n$ in $2018 \leqslant n \leqslant 3018$ allow for the existence of a triconnected set with $n$ squares?