<image>In the following sequence of shapes made out of matchsticks, how many squares does the nth shape consist of?

By observation, it can be found that the functional relationship between the total number of matchsticks, \( S \), in the nth shape and the number of shapes, \( n \), is given by _____.