there are a buch of options for repair
1. find a salvage yard with a donor car. if you are lucky you can find a place that will have an engine (you may need the turbo and intercooler off it and other items)
Car-Part.com--Used Auto Parts Market is one option there are other places (depending on where you live)
this option may be cheaper in the long run, although not as long-lived.
2. self rebuild. steep learning curve but you will learn a lot. you will need a local machine shop that will do machining services and assist. things like matching heads to the block, piston ring gap, etc. this is a more expensive option. probably the most fun, but may not be possible depending on your location. most machine shops love working with people and are willing to teach and advise.
3. buy replacement heads and engine that are ready to go. (long block) most expensive option. quickest path to full repair.
4. subaru sells an RA short block which you can get for a bit over 2k if you search/compare prices. this is only the bottom end/mid half of the engine. does not include the heads.
2008-2017 Subaru Short Block 10103AC890 | Subaru Online Parts