2. The afternoon class schedule needs to arrange 5 classes: Physics, Chemistry, Biology, and two self-study periods. If the first class cannot be Biology, and the last class cannot be Physics, then, the number of different ways to arrange the schedule is $\qquad$ kinds.
2.39.

According to the principle of inclusion-exclusion, the number of different ways to schedule classes is $\frac{5!}{2}-2 \times \frac{4!}{2}+\frac{3!}{2}=39$.