let rec count_subsets xs target =
  match xs with
  | [] -> if target = 0 then 1 else 0
  | x :: rest ->
    count_subsets rest target
    + count_subsets rest (target - x)

;;

count_subsets [1; 2; 3; 4; 5; 6; 7; 8] 10
