#! perl -slw use strict; my $n = <>; my %counts; ++$counts{ $_ } for split ' ', do{ local $/, <> }; my @sorted = sort{ $counts{$b} <=> $counts{$a} }keys %counts; my( $i, $min, $total ) = (0) x 3; ++$min while ( $total += $counts{ $sorted[ $i++ ] } ) < $n; print $min+1; print for @sorted[ 0 .. $min ];