if (size > 40) count = 5;
else if (size > 20) count = 4;
else if (size > 5 ) count = 3;
else if (size > 1 ) count = 2;
else count = 1;

No need to make 5 assignments when you're only using the last one