Some shapes are repetitions of others; e.g. D Major repeats the shape of C# Major, but one fret higher. In this case we call both shapes the C# Major formation. From this table, it looks like you have up to 36 shapes to memorize, but you essentially have only nine formations, which are highlighted in yellow. Memorize these and understand how to shift them when needed, e.g. how to shift the F Minor formation up two frets to produce G Minor, etc.
(Notice that there's also vertical or string-wise repetition in these shapes, e.g. between C, E and Ab Major. When this becomes clear, it will be evident that there are only three core formations.)