A delivery service charges $5 for the first mile and $2 for each additional mile for a delivery. If the total charge for a delivery was $17, how many miles was the delivery? Let's think step by step and output the final answer within \boxed{}.
user