A family went to a baseball game. They parked the car in a parking lot which charged ​$5. The cost per ticket was ​$27. Write an equation for the total cost of going to the baseball​ game, where y is the total cost and x is the total number of people. If the family spent ​$167​, how many people went to the​ game?