```go
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
var t int
fmt.Fscan(reader, &t)
for i := 0; i < t; i++ {
var n int
fmt.Fscan(reader, &n)
h := make([]int64, n)
var maxVal int64 = 0
for j := 0; j < n; j++ {
fmt.Fscan(reader, &h[j])
if h[j] > maxVal {
maxVal = h[j]
}
}
ans1 := solve(h, maxVal)
ans2 := solve(h, maxVal+1)
if ans1 < ans2 {
fmt.Fprintln(writer, ans1)
} else {
fmt.Fprintln(writer, ans2)
}
}
}
func solve(h []int64, target int64) int64 {
var s int64 = 0
var odd int64 = 0
for _, v := range h {
diff := target - v
s += diff
if diff%2 != 0 {
odd++
}
}
if s == 0 {
return 0
}
// Calculate minimum days based on the count of odd differences required.
// We can only reduce an odd difference by using a +1 move (odd day).
// Available +1 moves by day k is ceil(k/2).
// We need ceil(k/2) >= odd.
// Minimal k is 2*odd - 1.
k1 := int64(0)
if odd > 0 {
k1 = 2*odd - 1
}
// Calculate minimum days based on the total sum required.
// The cumulative capacity by day k is the sum of moves 1, 2, 1, 2, ...
// Sum(k) = 3*(k/2) + (k%2)
// We need Sum(k) >= s.
var k2 int64
q := s / 3
r := s % 3
if r == 0 {
k2 = 2 * q
} else if r == 1 {
k2 = 2*q + 1
} else {
k2 = 2*q + 2
}
if k1 > k2 {
return k1
}
return k2
}
```