The leader is baligh and so am I, but the rest of the people praying are not baligh. Does my salah count as jamaat still or do I have to pray separately?

Yes your Namaz is valid but in such situation as you said you have to stand just behind the Imam e Jama’at.