Function to return the count of distinct absolute values present in the Linked list
static int distinctCount ( Node head_ref1 ) { HashSet < int > s = new HashSet < int > ( ) ; Node ptr1 = head_ref1 ; while ( ptr1 != null ) { s . Add ( Math . Abs ( ptr1 . data ) ) ; ptr1 = ptr1 . next ; } return s . Count ; }