First girl, Deena danced with 6 boys.
Second girl, Chloe danced with 7 boys.
Third girl, Moira danced with 8 boys.
And so last girl, Anna danced with all boys, given is an arithmetic series as 6, 7, 8, ........, a+(n-1)d.
Let's assume number of girls are 'n'.
Last term of a.p. series would be number of boys = a+(n-1)d.
Here a=6 and d=1, so number of boys = 6+(n-1)*1 = 5+n.
Given there were 23 students.
So total students = number of girls + number of boys
23 = n + (5+n)
23 = 2n + 5
2n = 23-5 = 18
n = 9.
Hence, there were 9 girls and 14 boys.