Count Number of Balanced Permutations | Leetcode 3343