read n a=(`dd`) c=0 p=0 r=0 for i in `seq 10` do c=`echo ${a[@]} | tr ' ' '\n' | grep -cx $i` p=$((p+c/2)) r=$((r+c%2)) done echo $((p+r/4))