Approach: Turn the words into one linear equation, then remember the hidden integer rules — 40% of girls and 60% of boys must be whole numbers, so both counts are multiples of 5. Then push for the smallest total.
Step 1: Frame the equation. Let boys \(= B\), girls \(= G\). After 40% of girls and 60% of boys leave, remaining girls \(= 0.6G\), remaining boys \(= 0.4B\). Given remaining girls are 8 more than remaining boys:
\[ 0.6G = 0.4B + 8 \;\Rightarrow\; 3G = 2B + 40. \tag{1} \]
Step 2: Use the "whole-number-leaving" condition. Since exactly 40% of girls leave, \(0.4G = \tfrac{2}{5}G\) is an integer, so \(G\) is a multiple of 5. Similarly \(0.6B = \tfrac{3}{5}B\) integer makes \(B\) a multiple of 5. Write \(B = 5x,\ G = 5y\).
Step 3: Reduce. Putting these in (1): \[ 15y = 10x + 40 \;\Rightarrow\; 3y = 2x + 8 \;\Rightarrow\; y = \frac{2x+8}{3}. \]
Intuition: Total \(= 5(x+y)\), so to minimise it we hunt for the smallest \(x\) (with \(B>10\), i.e. \(x\ge 3\)) that makes \(2x+8\) divisible by 3.
Step 4: Test values. \(x=3:\ 14\) (no), \(x=4:\ 16\) (no), \(x=5:\ 18 \Rightarrow y=6\) (yes).
So \(B = 25\ (>10)\), \(G = 30\). Check: remaining \(0.6\times30 = 18\), \(0.4\times25 = 10\), and \(18-10 = 8\). ✓
Step 5: Answer. \[ T = B + G = 25 + 30 = \boxed{55}. \]