for t in range(int(input())):
    n=int(input())
    if n%2==0:
        print(int(n/2-1))
    else:
        print(int(n//2))
for t in range(int(input())):
    n=int(input())
    if n%2==0:
        print(int(n/2-1))
    else:
        print(int(n//2))