In a class of 40 students, who study mathematics, physics and chemistry, the number of students studying mathematics is 2 more than 40% of those studying chemistry, while 20 of the students study physics. Three less than one fifth of the total students in the class study all the three subjects. The number of students studying only physics is 2 less than the number of students studying mathematics. The number of students studying only mathematics and only chemistry is 3 and 15 respectively. The number of students studying mathematics as well as physics is the same as the number of students studying mathematics as well as chemistry. How many students are studying both mathematics and chemistry but not all the three subjects?