Help me in solving XOREQUAL problem

My issue

i think we are supposed to count the number of even numbers in the range including 0 . so why this answer of mine is not working?

My code

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc= new Scanner(System.in);
		int t = sc.nextInt();
		int mod=1000000007;
		while(t-- >0){
		    
			long n = sc.nextLong();
			n=(long)Math.pow(2,n-1) % mod;
			long ans=(n/2)+1;
			System.out.println(ans%mod);
		}

	}
}

Problem Link: Xor Equality Practice Coding Problem