      SUBROUTINE SQFCT(F)
C     *************************
      IMPLICIT REAL*8(A-H,O-Z), INTEGER (I-N)
	include 'input.inc'
	include 'fitl.inc'
	include 'tempstor.inc'
      COMMON/FOUT/OUTFL(400)
	character*3 answer
	common /fitting/nfitting,answer
      F=0.0D0
	if(answer(1:1).eq.'y'.or.answer(1:1).eq.'Y')then
	type 22
22	format(/)
	type 21,(outfl(nval(i)),i=1,ncond)
21	format(5e12.4)
	type 21,(valf(i),i=1,ncond)
	endif
      IF(ISTART.NE.0)GO TO 1
      DO 20 I=1,NCOND
      VAL0=OUTFL(NVAL(I))
	if(nval(i).ge.93.and.nval(i).le.96)outfl(nval(i))
     &	  =dmax1(outfl(nval(i)),valf(i))
   20 RVAL(I)=VAL0-(VAL0-VALF(I))/NDIV
      ISTART=1
    1 DO 10 I=1,NCOND
	if(nval(i).ge.93.and.nval(i).le.96)outfl(nval(i))
     &	  =dmax1(outfl(nval(i)),valf(i))
   10 F=F+((OUTFL(NVAL(I))-RVAL(I))*WGHT(I))**2
      F=F/WV
      F=DSQRT(F)
	if(answer(1:1).eq.'y'.or.answer(1:1).eq.'Y')type *,' FIG ',f
      RETURN
      END
