      SUBROUTINE HSR2(A,LA,N)
      INTEGER I,J,K,L,LA,M,N
      REAL A(LA,1),S
      IF ( N .GT. 1 ) GOTO 10
      A(1,1) = 1.
      RETURN
10    L = N - 2
      M = N - 1
      K = N
      S = A(N,M)
      A(N,N) = 1. - S*A(N,M)
      A(M,N) = -S*A(M,M)
20    J = M
      M = M - 1
      IF ( M .EQ. 0 ) GOTO 50
      S = 0.
      DO 30 I = J,N
30         S = S + A(I,M)*A(I,K)
      A(M,K) = -S*A(M,M)
      DO 40 I = J,N
40         A(I,K) = A(I,K) - S*A(I,M)
      GOTO 20
50    K = K - 1
      M = K
      S = -A(K,K)
      DO 60 I = K,N
60          A(I,K) = S*A(I,K)
      A(K,K) = 1. + A(K,K)
      IF ( K .GT. 1 ) GOTO 20
      RETURN
      END
