package main

func countSubMultisetsBrute(nums []int, l int, r int) int {
	ln := len(nums)
	count := 0
	for i := 0; i < ln; i++ {
		sum := nums[i]
		if sum >= l && sum <= r {
			count++
		} else {
			continue
		}
		for j := 0; j < ln; j++ {
			if i == j {
				continue
			}
			sum += nums[j]
			if sum >= l && sum <= r {
				count++
			} else {
				break
			}
		}
	}
	return count
}

func CountSubMultisets(nums []int, l int, r int) int {
	return countSubMultisetsBrute(nums, l, r)
}
