As all the hydrogen atoms are in the first excited state i.e. at n = 2, there is only one possible transition i.e. n = 2 → n = 1. ( n = 1 represents the ground state and is the lowest energy level). This gives one spectral line.
As all the helium ions are in the 3rd excited stated (n = 4), the possible transitions are:
4→3
4→2
4→1
3→2
3→1
2→1
As the energy levels in helium ions are different to those in hydrogen, these transitions will show different lines in the spectra, hence there are 6 more lines.
Now, for lithium ions in the 5th excited stated (n = 6), the possible transitions are:
6→5
6→4
6→3
6→2
6→1
5→4
5→3
5→2
5→1
4→3
4→2
4→1
3→2
3→1
2→1
As the energy levels in lithium ions are different to those in hydrogen and helium ions, there is an addition of further new 15 spectral lines.
Hence, total number of spectral lines = 1 + 6 + 15 = 22