      subroutine shell(n,a,swp,comp)
      real t,a(n)
      integer d,n
      common inc(20),incptr
      swp = 0
      comp = 0
      incp = incptr
20    if(incp.lt.1) goto 100
      d = inc(incp)
           do 80 j = d,n
                t = a(j)
                i = j - d
30              if (i.lt.1) goto 80
                comp = comp + 1
                if (t.ge.a(i)) goto 80
                a(i+d) = a(i)
                a(i) = t
                swp = swp + 1
                i = i - d
                goto 30
80         continue
      incp = incp - 1
      goto 20
100   continue
      return
      end
