open Batteries

let () =
  let n = Scanf.scanf "%d " (fun a -> a) in
  let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun a -> a)) in

  let rec loop i j n accum res =
    if i = n then (
      Printf.printf "%d\n" res;
    ) else (
      if j = n then (
        loop (i+1) j n (accum lxor a.(i)) (res+j-i-1)
      ) else (
        if (accum land a.(j) = 0) then (

          let v = accum lxor a.(j) in
          loop i (j+1) n v (res+1)

        ) else (
          loop (i+1) j n (accum lxor a.(i)) (res+j-i-1)
        )
      )
    )
  in
  loop 0 0 n 0 0
