Easy to make, but require time, so i can't help you.
But there's what you need using CLEO and SAMPFUNCS.:
//get number of dialog elements
0B54: samp 1@ = listbox_items_count
//substract one from total cout
1@ -= 1 //last item is actually the null terminator
chatmsg "num of elements %d" -1 1@...