Traverse through remaining nodes
int count = 0 ; for ( Node * curr = head -> next ; curr != NULL ; curr = curr -> next ) { if ( s . find ( curr -> data ) != s . end ( ) ) count ++ ; s . insert ( curr -> data ) ; }