public static void solve ( ) throws Exception {
  int n = f . ni ( ) ;
  int arr [ ] = new int [ n ] ;
  for ( int i = 0 ;
  i < n ;
  ++ i ) arr [ i ] = f . ni ( ) ;
  sort ( arr ) ;
  int ans = 0 ;
  for ( int i = 0 ;
  i + 1 < n ;
  i += 2 ) {
    ans += arr [ i + 1 ] - arr [ i ] ;
  }
  pn ( ans ) ;
}

public static void solve ( ) throws Exception { int n = f . ni ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; ++ i ) arr [ i ] = f . ni ( ) ; sort ( arr ) ; int ans = 0 ; for ( int i = 0 ; i + 1 < n ; i += 2 ) { ans += arr [ i + 1 ] - arr [ i ] ; } pn ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) (throws (type_identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier)) update: (assignment_expression left: (identifier) right: (decimal_integer_literal)) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (identifier))))))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier))))))