from the sti service manual...
Manufacturer body area
[*] JF1: Passenger car, FHI made
Car line
[*] G: IMPREZA
Body type
[*] D: 4 Door Sedan
[*] G: Wagon
Displacement
[*] 2: 2.0 L AWD Turbo
[*] 6: 2.5 L AWD
[*] 7: 2.5 L AWD Turbo
Grade
[*] 5: TS
[*] 7: RS
[*] 8: OUTBACK
[*] 9: WRX
[*] 0: STi
Restraint
[*] 5: Manual belts, dual airbag
[*] 6: Manual belts, dual airbag, side airbag
Check digit
[*] 0 to 9 & X
Model year
[*] 4: 2004MY
Transmission type
[*] G: Full-time AWD 5-speed MT single range
[*] H: Full-time AWD 4-speed AT
[*] L: Full-time AWD 6-speed MT
Serial number
[*] 500001 or more: 4-Door Sedan
[*] 800001 or more: Wagon
so it looks like yours is 5021; mine is *****. (i'm paranoid...)