perl -ne 'exists $x{$_}?delete $x{$_}:$x{$_}++;}{print for sort keys %x;' < input.txt > output.txt