while read -s -n 1 C;do $((++a[C]));done;for i in ${a[@]};do for((j=$i;j>0;j--));do o+=$i;done;done;echo $o