You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 1442. Count Triplets That Can Form Two Arrays of Equal XOR.go
    path of file: ./repos/LeetCode-Go/leetcode/1442.Count-Triplets-That-Can-Form-Two-Arrays-of-Equal-XOR
    
    the code of the file until where you have to start completion: package leetcode

func countTriplets(arr []int) int {
	prefix, num, count, total := make([]int, len(arr)), 0, 0, 0
	for i, v := range arr {
		num ^= v
		prefix[i] = num
	}
	for i := 0; i < len(prefix)-1; i++ {
		for k := i + 1; k < len(prefix); k++ {
			total = prefix[k]
			if i > 0 {
				tot
    
func countTriplets(arr []int) int {
	prefix, num, count, total := make([]int, len(arr)), 0, 0, 0
	for i, v := range arr {
		num ^= v
		prefix[i] = num
	}
	for i := 0; i < len(prefix)-1; i++ {
		for k := i + 1; k < len(prefix); k++ {
			total = prefix[k]
			if i > 0 {
				total ^= prefix[i-1]
			}
			if total == 0 {
				count += k - i
			}
		}
	}
	return count
}