Sum column values matching other field

this is part of a KT i am going thru.
i am writing a script in bash shell, linux where i have 2 columns where 1st signifies the nth hour like 00, 01, 02...23 and 2nd the file size.

sample data attached.
Desired output is 3 columns which will give the nth hour, number of entries in nth hour and sum of the file sizes on nth hour.

i am trying below code but it's not working.

for (( i=00; i<=23; i++ ))
  do
      filecount=`awk '{if ($1 == "$i") print $2;}' interim.txt |wc -l`
      filesize=`awk '{if ($1 == "$i") print $2;}' interim.txt | awk '{sum += $1} END {print sum}'|awk '{filesize=$1/1024/1024; print filesize"MB"}'`
      echo $i $filecount $filesize >> report.txt
   done

any help would be greatly appreciated.

ty.

try

awk '{arr[$1]+=$2;arr2[$1]++} END {for (i in arr) {print i,arr,arr2}}' file

Thanks a lot for this.
it is generating output but not is sorted order and file sizes are not in MB.
Also I need the hours where there is no information.

for example:

00 21 1.2MB
01 0   0
02 41 5.41MB
03 0   0
.
.
.
23.......

As you didn't mention the units of your file sizes, is reasonably difficult to guess what they are, and even more to output in MB.
Anyhow, try

awk     '
NR>1 &&
!($1 in CNT)    {print last, CNT[last], SIZ[last]/1048576}
                {SIZ[$1]+=$2
                 CNT[$1]++
                 last=$1
                }
END             {print last, CNT[last], SIZ[last]/1048576}
        ' /tmp/sample.txt
01 7 0.0996408
02 3 0.0981874
.
.
.
23 1 0.0107212