The Maslov index and the spectrum of differential operators