The difference that "verschieden" and "gleiche" make.
Let's jump into examples directly :
-Diese Hüte haben verschieden Größen.
-Diese Hüte haben die gleiche Größe.
In the first example why we added "en" to "Größ" why we even changed "Groß" to "Größ" in the first place?
In the second example why are we using "die" and why we used "Größe" instead of "Größen"?
first: verschiedene Größen -(different sizes):is plural (it is more than only one size)
second: gleiche Größe- (same size):is singular ( it is only one size for all)
you are having the same thing (change of the word form from singular to plural) in english too: size for singular sizes for plural.
groß is an adjective (how is it ? it is big or groß in german.)
Größe is a noun : die Größe
you can say groß changes its form when it becomes a noun
or when it is used in an increase form like:
groß - größer - am größten (big - bigger - biggest)
the die in the second sentence refers to the Größe not to the gleiche. sometimes we put an adjective between the article and the noun - if the adjective is used to directly discribe the noun in this case gleich(e) is the adjective to discribe the noun (Größe).
this is also found in english as well like:
the hot tea, the small room, the red flower etc.