Trey sold t-shirts and hats at a festival. His total profit was $106. He made a $4 profit for each t-shirt he sold. He also made a profit of $34 from selling hats. How many t-shirts did he sell?