Example 3-2 A school only offers three courses: Mathematics, Physics, and Chemistry. It is known that the number of students taking these three courses are 170, 130, and 120, respectively. The number of students taking both Mathematics and Physics is 45; the number of students taking both Mathematics and Chemistry is 20; the number of students taking both Physics and Chemistry is 22; and the number of students taking all three courses is 3. Try to calculate the total number of students in the school.