      PROGRAM cardGameForTwo
      IMPLICIT NONE
      INTEGER :: N
      INTEGER,ALLOCATABLE :: a(:)
      INTEGER :: buffer(2),ans,i,piyo, alice,bob
      LOGICAL :: flag
      
      READ*,N
      ALLOCATE( a(N) )
      READ*,a(:)
      
      DO while(.TRUE.)
        flag = .TRUE. 
        DO i = 1,N-1
          IF(a(i)<a(i+1))THEN
            buffer(1:2) = a(i:i+1)
            a(i) = buffer(2); a(i+1) = buffer(1)
            flag = .FALSE.
          END IF
        END DO
        
        IF(flag)THEN
        !sort has end
        EXIT
        END IF
      END DO 
      
      ans = 0
      alice = 0
      bob = 0
      
      flag = .TRUE.
      DO i = 1,N
        IF(flag)THEN
          alice = alice + a(i)
          flag = .FALSE.
        ELSE
          bob = bob + a(i)
          flag = .TRUE.
        END IF
      END DO
      
      ans = alice - bob
      
      print'(I0)',ans
      
      
      
      
      
      
      
      
      
      END PROGRAM