tail -n +2 > /tmp/in
#cat /tmp/in
N=`cat /tmp/in | sort -n | uniq -c | sort | tac | awk '{print $1}' | uniq -c | awk '{print $1}'`
cat /tmp/in | sort | uniq -c | sort | tac | awk '{print $2}' | head -$N | sort