  In this paper, we first introduce the number of signed permutations with
exactly $k$ inversions, which is denoted by $i_B(n,k)$ and called
\textit{Mahonian numbers of type $B$}. Then we provide a recurrence relation
for the Mahonian numbers $i_B(n,k)$. In addition, we give an explicit recursive
description for the summation of inversions of all permutations in the
hyperoctahedral group $B_n$, denoted by $\mathcal{B}_n$. Furthermore, we
enumerate the total number of inversions in permutations in the hyperoctahedral
group $B_n$ concretely with the help of an inversion statistic and a backward
permutation concepts on $B_n$.
