C-----------------------------------------------------------------------
C-----------------------------------------------------------------------
      FUNCTION NWORDS(N,LUN)                                            
                                                                        
      COMMON /USRINT/ NVAL(32),INV(15000,32),VAL(15000,32)              
                                                                        
      REAL*8 VAL                                                        
                                                                        
C-----------------------------------------------------------------------
C-----------------------------------------------------------------------
                                                                        
      NWORDS = 0                                                        
                                                                        
      DO K=1,NINT(VAL(N,LUN))                                           
      NWORDS = NWORDS + NINT(VAL(NWORDS+N+1,LUN))                       
      ENDDO                                                             
                                                                        
      RETURN                                                            
      END                                                               
