The Bug Dance

You probably know that one way to tell an insect from a spider is to count its legs. All insects have six legs, and all spiders have eight legs. So if some insects and spiders went to a dance, and there were 48 dancing legs, how many insects and how many spiders were at the dance?