We consider the family $\Gamma:I\times I\rightarrow\Lambda(n)\times\Lambda(n)$ defined by $\Gamma(\lambda,t)=(\Psi_\lambda(t)\gamma_1(\lambda),\gamma_2(\lambda))$. We set

$$\eta_1(t)=\Gamma(0,t), \eta_2(\lambda)=\Gamma(\lambda,1), \eta_3(t)=\Gamma(1,1-t), \eta_4(\lambda)=\Gamma(1-\lambda,0).$$ As $I\times I$ is contractible, $\eta_1\ast\eta_2\ast\eta_3\ast\eta_4$ is homotopic to a constant path by a homotopy with fixed endpoints. Hence the Maslov index of $\eta_1\ast\eta_2\ast\eta_3\ast\eta_4$ vanishes by (viii’).\
As $\mu_{Mas}(\eta_4)=-\mu_{Mas}(\gamma_1,\gamma_2)$, $\mu_{Mas}(\eta_3)=-\mu_{Mas}(\Psi_1(\cdot)\gamma_1(1),\gamma_2(1))$ and $\Psi_\lambda(0)=I_{2n}$ for all $\lambda\in I$, it follows that

$$\mu_{Mas}(\Psi \gamma_1,\gamma_2)=-\mu_{Mas}(\Psi_0(\cdot)\gamma_1(0),\gamma_2(0))+\mu_{Mas}(\gamma_1,\gamma_2)+\mu_{Mas}(\Psi_1(\cdot)\gamma_1(1),\gamma_2(1)).$$ The corollary is now an immediate consequence of the previous theorem.

Note that if $S_0(t)=S_1(t)$ for all $t\in I$, then $\Psi_0(t)=\Psi_1(t)$, $t\in I$. If, moreover, $\gamma_1(0)=\gamma_1(1)$ and $\gamma_2(0)=\gamma_2(1)$, then we obtain from the previous corollary that

$$\operatorname{sf}(\mathcal{A})=\mu_{Mas}(\gamma_1,\gamma_2).$$ Consequently, under these assumptions the paths and have the same spectral flow and so the spectral flow of does not depend on the family of matrices $S$. Note that each $S_\lambda$ is $\mathcal{A}_\lambda$-compact, i.e. $S_\lambda:\mathcal{D}(\mathcal{A}_\lambda)\rightarrow L^2(I,\mathbb{R}^{2n})$ is compact with respect to the graph norm of $\mathcal{A}_\lambda$ on $\mathcal{D}(\mathcal{A}_\lambda)$. Let us point out that for closed paths of bounded selfadjoint Fredholm operators, the spectral flow is invariant under perturbations by compact selfadjoint operators (see [@FPR Prop. 3.8]).\
Let us now consider again the general setting of Corollary \[cor-Hamiltonian\], let $\alpha, \beta:[0,1]\rightarrow[0,1]$ be two continuous functions such that

$$\begin{aligned}
\label{alphabeta}
\beta(\lambda)=\alpha(\lambda)+\lambda,\quad \lambda\in[0,1].\end{aligned}$$

Our final result generalises Theorem 2 of 