Phoenix has $n$ coins with weights $2^1, 2^2, \dots, 2^n$. He knows that $n$ is even.

He wants to split the coins into two piles such that each pile has exactly $\frac{n}{2}$ coins and the difference of weights between the two piles is minimized. Formally, let $a$ denote the sum of weights in the first pile, and $b$ denote the sum of weights in the second pile. Help Phoenix minimize $|a-b|$, the absolute value of $a-b$.


-----Input-----

The input consists of multiple test cases. The first line contains an integer $t$ ($1 \le t \le 100$) — the number of test cases.

The first line of each test case contains an integer $n$ ($2 \le n \le 30$; $n$ is even) — the number of coins that Phoenix has. 


-----Output-----

For each test case, output one integer — the minimum possible difference of weights between the two piles.


-----Example-----
Input
2
2
4

Output
2
6



-----Note-----

In the first test case, Phoenix has two coins with weights $2$ and $4$. No matter how he divides the coins, the difference will be $4-2=2$.

In the second test case, Phoenix has four coins of weight $2$, $4$, $8$, and $16$. It is optimal for Phoenix to place coins with weights $2$ and $16$ in one pile, and coins with weights $4$ and $8$ in another pile. The difference is $(2+16)-(4+8)=6$.

Difficulty: EASY

Solutions:
t = int(input())
itog = []
for m in range(t):
	n = int(input())
	calc = 0
	for i in range(1, n):
		if i < n / 2:
			calc = calc + 2 ** i
		else:
			calc = calc - 2 ** i
	calc = calc + 2 ** n
	itog.append(abs(calc))
for m in range(t):
	print(itog[m])


t = int(input())
for i in range(t):
	num = int(input())
	diff = 2 ** num
	for i in range(1, num):
		if i < num / 2:
			diff = diff + 2 ** i
		else:
			diff = diff - 2 ** i
	print(diff)


import sys
stdin = sys.stdin
ns = lambda : stdin.readline().rstrip()
ni = lambda : int(stdin.readline().rstrip())
nm = lambda : map(int, stdin.readline().split())
nl = lambda : list(map(int, stdin.readline().split()))
t = ni()
for _ in range(t):
	n = ni()
	g = 2 ** n + 2 ** (n // 2) - 2
	print(g * 2 - 2 ** (n + 1) + 2)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	d = n // 2
	s = 0
	s += 2 ** n
	for i in range(1, d):
		s += 2 ** i
	s2 = 0
	for i in range(d, n):
		s2 += 2 ** i
	print(abs(s - s2))


for _ in range(int(input())):
	n = int(input())
	x = 0
	for i in range(int(n / 2), n):
		x += 2 ** i
	x2 = 2 ** n
	for i in range(1, int(n / 2)):
		x2 += 2 ** i
	print(x2 - x)


t = int(input())
for _ in range(t):
	n = int(input())
	ll = [2 ** i for i in range(1, n + 1)]
	ll = [ll[-1]] + ll[:-1]
	result = sum(ll[:n // 2]) - sum(ll[n // 2:])
	print(result)


t = int(input())
for i in range(t):
	p = int(input())
	a = []
	for i in range(p):
		a.append(pow(2, i + 1))
	s1 = a[p - 1]
	s = 0
	for i in range(0, int(p / 2 - 1)):
		s1 += a[i]
	for i in range(int(p / 2 - 1), int(p - 1)):
		s += a[i]
	print(abs(s1 - s))


from sys import stdin, stdout
T = int(stdin.readline())
for i in range(T):
	N = int(stdin.readline())
	res = 2 + 2 * (pow(2, N // 2) - 2)
	stdout.write(str(res) + '\n')


for i in range(int(input())):
	n = int(input())
	first = 0
	sec = 0
	if n == 2:
		print(2)
	elif n > 2:
		e = n // 2
		for i in range(1, e):
			first += 2 ** i
		first += 2 ** n
		for i in range(e, n):
			sec += 2 ** i
		print(abs(first - sec))


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
t = ini()
for _ in range(t):
	n = ini()
	print(2 ** n + sum([2 ** i for i in range(1, n // 2)]) - sum((2 ** i for i in range(n // 2, n))))


import math
a = int(input())
for i in range(a):
	list1 = []
	first = []
	second = []
	x = int(input())
	for i in range(1, x + 1):
		list1.append(math.pow(2, i))
	k = len(list1)
	for i in range(0, int(k / 2) - 1):
		first.append(list1[i])
	m = len(list1) - 1
	first.append(list1[m])
	for i in range(int(k / 2 - 1), k - 1):
		second.append(list1[i])
	sumfirst = sum(first)
	sumsecond = sum(second)
	print(abs(int(sumfirst - sumsecond)))


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	for i in range(1, n + 1):
		a.append(2 ** i)
	a1 = 2 ** n
	b1 = 0
	for i in range(n // 2 - 1):
		a1 += a[i]
	for i in range(n // 2 - 1, n - 1):
		b1 += a[i]
	print(a1 - b1)


for i in range(int(input())):
	a = int(input())
	cnt = []
	for i in range(1, a + 1):
		cnt.append(2 ** i)
	b = sum(cnt[:a // 2])
	print(b)


t = int(input())
for i in range(t):
	a = int(input())
	m = 1
	c = []
	v = []
	(ans1, ans2) = (0, 0)
	while m <= a:
		c.append(2 ** m)
		m += 1
	s = len(c) / 2 - 1
	v.append(c.pop())
	while s > 0:
		v.append(c.pop(0))
		s -= 1
	for j in range(len(v)):
		ans1 += v[j]
	for b in range(len(c)):
		ans2 += c[b]
	print(abs(ans1 - ans2))


for _ in range(int(input())):
	n = int(input())
	print(int(2 ** (n / 2 + 1) - 2))


for x in range(int(input())):
	n = int(input())
	(a, b) = (2 ** n, 0)
	for x in range(1, n // 2):
		a += 2 ** x
	for x in range(n // 2, n):
		b += 2 ** x
	print(abs(a - b))


t = int(input())
for _ in range(t):
	n = int(input())
	a1 = 2 ** (n // 2 - 1) - 1
	a1 = 2 * a1 + 2 ** n
	b1 = 2 * (2 ** (n // 2) - 1)
	b1 = 2 ** (n // 2 - 1) * b1
	print(a1 - b1)


import math
tc = int(input())
for _ in range(tc):
	a = int(input())
	l = [2 ** i for i in range(1, a + 1)]
	sum = l[-1]
	sum1 = 0
	if len(l) == 2:
		print(abs(l[0] - l[1]))
	else:
		for i in range(0, len(l) // 2 - 1):
			sum += l[i]
		for j in range(len(l) // 2 - 1, len(l) - 1):
			sum1 += l[j]
		print(sum - sum1)


t = int(input())
for _ in range(t):
	n = int(input())
	ans = 0
	for i in range(0, n // 2):
		ans += 2 ** (i + 1)
	print(ans)


from collections import Counter
from _collections import defaultdict
import math
rs = lambda : input().strip()
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rls = lambda : list(map(str, input().split()))
a = [0] * 32
for i in range(1, 31):
	a[i] = pow(2, i)
t = int(input())
for _ in range(0, t):
	n = int(input())
	ans = 0
	c1 = 1
	c2 = 0
	print(pow(2, n // 2 + 1) - 2)


for tc in range(int(input())):
	n = int(input())
	print(int(2 ** (n / 2 + 1) - 2))


alph = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(int(input())):
	n = int(input())
	sum1 = 0
	i = 1
	j = n
	con = 0
	sum1 = 2 ** n + 2 ** (n // 2) - 2
	total = 2 ** (n + 1) - 2
	sum2 = total - sum1
	if n == 2:
		print(2)
	else:
		print(abs(sum1 - sum2))


for _ in range(int(input())):
	n = int(input())
	big = 2 ** n + sum([2 ** i for i in range(1, int(n / 2))])
	small = 2 ** (n - 1) + sum([2 ** i for i in range(int(n / 2), n - 1)])
	print(big - small)


for _ in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	if n == 2:
		print(2)
	else:
		a += 2 ** n
		for i in range(n - 1, n // 2 - 1, -1):
			b += 2 ** i
		for i in range(n // 2 - 1, 0, -1):
			a += 2 ** i
		print(abs(a - b))


t = int(input())
for _ in range(t):
	n = int(input())
	k = n // 2
	var = k - 1
	l = []
	for i in range(1, n + 1):
		l.append(pow(2, i))
	v = l[:var]
	ans = sum(v)
	ans += l[n - 1]
	nia = l[k - 1:n - 1]
	ans1 = sum(nia)
	print(abs(ans - ans1))


for _ in range(int(input())):
	n = int(input())
	ss = 2
	for i in range(n // 2 - 1):
		ss = ss * 2 + 2
	print(ss)


import sys
input = sys.stdin.readline
inf = 100000000000000000
mod = 998244353
for CASES in range(int(input())):
	n = int(input())
	sum = 0
	num = 0
	for i in range(1, n + 1):
		sum += 1 << i
	for i in range(1, n // 2):
		num += 1 << i
	num += 1 << n
	print(num * 2 - sum)


t = int(input())
for i in range(t):
	n = int(input())
	if n > 2:
		l = [pow(2, i) for i in range(1, n + 1)]
		big = max(l)
		l.remove(big)
		small = max(l)
		l.remove(small)
		for i in range(1, n // 2):
			mm = max(l)
			l.remove(mm)
			ss = min(l)
			l.remove(ss)
			if small < big:
				small += mm
				big += ss
			else:
				small += ss
				big += mm
		print(abs(small - big))
	else:
		print(2)


for t in range(int(input())):
	n = int(input())
	print(int(pow(2, n / 2 + 1) - 2))


def io():
	n = int(input())
	return n

def solve():
	n = io()
	ls = [2 ** i for i in range(1, n + 1)]
	pile_a = ls[:n // 2 - 1] + [ls[-1]]
	pile_b = ls[n // 2 - 1:n - 1]
	ans = abs(sum(pile_a) - sum(pile_b))
	print(ans)
T = int(input())
for _ in range(T):
	solve()


for _ in range(int(input())):
	n = int(input())
	arr = [pow(2, i) for i in range(1, n + 1)]
	a = arr[-1] + sum(arr[:n // 2 - 1])
	b = sum(arr[n // 2 - 1:n - 1])
	print(abs(a - b))


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	sum1 = 0
	sum2 = 0
	sum1 += 2 ** n
	k = int(n / 2)
	for i in range(1, int(n / 2)):
		sum1 += 2 ** i
	for i in range(int(n / 2), n):
		sum2 += 2 ** i
	res = abs(sum1 - sum2)
	print(res)


import collections
import operator
n = int(input())
for i in range(n):
	number_coin = int(input())
	sol = 2 ** (number_coin / 2 + 1) - 2
	print(int(sol))


for i in range(int(input())):
	a = int(input())
	print(pow(2, a // 2 + 1) - 2)


t = int(input())
for test_case in range(t):
	n = int(input())
	print((2 << n // 2) - 2)


for i in range(int(input())):
	n = int(input())
	x = [2 ** (i + 1) for i in range(n)]
	a = x[:n // 2 - 1] + [x[-1]]
	b = x[n // 2 - 1:n - 1]
	print(abs(sum(a) - sum(b)))


T = int(input())
while T:
	n = int(input())
	z = []
	x = []
	for i in range(1, n + 1):
		if i < n // 2 or i == n:
			z.append(2 ** i)
		else:
			x.append(2 ** i)
	print(abs(sum(z) - sum(x)))
	T -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	su = 2 ** (n + 1) - 2
	l = 2 ** n + 2 ** (n // 2) - 2
	print(abs(su - l * 2))


n = int(input())
for i in range(n):
	a = int(input())
	result = 0
	for i in range(1, a // 2 + 1):
		result += 2 ** i
	print(result)


import sys
sys.setrecursionlimit(10000)

class Memoize:

	def __init__(self, f):
		self.f = f
		self.memo = {}

	def __call__(self, *args):
		if not args in self.memo:
			self.memo[args] = self.f(*args)
		return self.memo[args]

class Recurse(Exception):

	def __init__(self, *args, **kwargs):
		self.args = args
		self.kwargs = kwargs

def recurse(*args, **kwargs):
	raise Recurse(*args, **kwargs)

def tail_recursive(f):

	def decorated(*args, **kwargs):
		while True:
			try:
				return f(*args, **kwargs)
			except Recurse as r:
				args = r.args
				kwargs = r.kwargs
				continue
	return decorated
t = int(input())
for _ in range(t):
	n = int(input())
	pile1 = int(2 ** (n / 2) - 2 + 2 ** n)
	pile2 = int(2 ** (n + 1) - 2 - pile1)
	print(abs(pile1 - pile2))


final_result = list()
n = int(input())
for i in range(n):
	terms = int(input())
	a = list()
	b = list()
	half = int(terms / 2)
	result = list(map(lambda x: 2 ** x, range(terms + 1)))
	del result[0]
	for i in range(half - 1):
		a.append(result[i])
	a.append(result[-1])
	b = result[half - 1:-1]
	total_a = sum(a)
	total_b = sum(b)
	final_result.append(abs(total_a - total_b))
for i in final_result:
	print(i)


for _ in range(int(input())):
	n = int(input())
	x = 4
	res = 2
	if n == 2:
		print(2)
	else:
		for i in range(n // 2 - 1):
			res += x
			x *= 2
		print(res)


for _ in range(int(input())):
	n = int(input())
	(a, b) = (0, 0)
	i = 1
	while i <= (n - 2) // 2:
		a += 2 ** i
		i += 1
	while i <= n - 1:
		b += 2 ** i
		i += 1
	a += 2 ** i
	print(abs(a - b))


t = int(input())
for i in range(t):
	n = int(input())
	m = 2 * (2 ** (n // 2 - 1) - 1) + 2 ** n
	k = 2 * (2 ** n - 1) - m
	j = m - k
	print(j)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [2 ** n]
	b = [2 ** (n - 1)]
	for i in range(n - 2, 0, -1):
		if sum(a) > sum(b) and len(b) < n // 2:
			b.append(2 ** i)
		else:
			a.append(2 ** i)
	ans = abs(sum(a) - sum(b))
	print(ans)


t = int(input())
for tt in range(t):
	n = int(input())
	large = (1 << n) + (1 << n // 2) - 2
	small = (1 << n // 2) - 1 << n // 2
	print(large - small)


class Solution:

	def __init__(self):
		self.n = int(input())

	def solution(self):
		(sum1, sum2) = (2 ** self.n, 0)
		for i in range(1, self.n // 2):
			sum1 += 2 ** i
		for i in range(self.n // 2, self.n):
			sum2 += 2 ** i
		print(sum1 - sum2)

def main():
	for _ in range(int(input())):
		ob = Solution()
		ob.solution()
main()


b = 0
a = int(input())
while b < a:
	number1 = 0
	number2 = 0
	b += 1
	c = int(input())
	deck = [0] * c
	deck[0] = 2
	for i in range(1, c):
		deck[i] = deck[i - 1] * 2
	if c != 1 and c != 2:
		for i in range(c - 2, int(c / 2 - 2), -1):
			number1 += deck[i]
		for i in range(0, int(c / 2 - 1)):
			number2 += deck[i]
		number2 += deck[c - 1]
		print(number2 - number1)
	elif c == 2:
		print(deck[1] - deck[0])
	else:
		print(deck[0])


t = int(input())
nList = list()
for i in range(t):
	nList.append(int(input()))
for i in range(t):
	toplam = 0
	for j in range(1, int(nList[i] / 2) + 1):
		toplam += 2 ** j
	print(toplam)


T = int(input())
for t in range(T):
	a = int(input())
	n = a // 2
	s = 2 ** a
	for i in range(1, n):
		s += 2 ** i
	z = 0
	for i in range(n, a):
		z += 2 ** i
	print(s - z)


t = int(input())
for k in range(t):
	n = int(input())
	print(2 ** (n // 2 + 1) - 2)


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	c = 0
	b = 0
	for i in range(1, n + 1):
		l.append(2 ** i)
	for i in range(n // 2 - 1):
		c += l[i]
	c += l[n - 1]
	for i in range(n // 2 - 1, n - 1):
		b += l[i]
	print(abs(c - b))


t = int(input())
for i in range(t):
	n = int(input())
	sum = 0
	for j in range(1, n // 2 + 1):
		sum += int(pow(2, j))
	print(sum)


t = int(input())
for w in range(t):
	n = int(input())
	a = 0
	b = 0
	for i in range(1, n // 2):
		a += pow(2, i)
	a += pow(2, n)
	for i in range(n // 2, n):
		b += pow(2, i)
	print(a - b)


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from itertools import accumulate

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def common(l1, l2):
	return set(l1).intersection(l2)

def solution():
	for _ in range(Int()):
		n = Int()
		print(int(pow(2, n / 2 + 1) - 2))
solution()


t = int(input())
for i in range(t):
	n = int(input())
	a = 2 ** (n - 1)
	r = 0.5
	sumn = a * (1 - r ** (n / 2)) * 2
	tsum = 2 * (2 ** n - 1)
	sumn2 = tsum - sumn
	if sumn > sumn2:
		print(int(sumn - sumn2))
	else:
		print(int(sumn2 - sumn))


import math
from collections import defaultdict, deque
from bisect import bisect_left, bisect_right
import time

def solve():
	n = int(input())
	ans = 0
	curr = 1
	for i in range(1, n // 2):
		curr *= 2
		ans += curr
	for i in range(n // 2, n - 1):
		curr *= 2
		ans -= curr
	curr *= 2
	ans += curr
	print(ans)
t = int(input())
for _ in range(t):
	solve()


from sys import stdin, stdout

def find(N):
	if not N:
		return 0
	X = N // 2
	arr = [2 ** x for x in range(1, N + 1)]
	a = arr[-1] + sum(arr[:X - 1])
	b = sum(arr[X - 1:-1])
	return a - b

def main():
	for _ in range(int(stdin.readline())):
		N = int(stdin.readline())
		print(find(N))
main()


import os

def f(n):
	n2 = n // 2
	p1 = 2 ** n2 - 2 + 2 ** n
	p2 = 2 ** n - 2 - (2 ** n2 - 2)
	return abs(p1 - p2)

def pp(input):
	n_test = int(input())
	for i in range(n_test):
		print(f(int(input())))
if 'paalto' in os.getcwd():
	from string_source import string_source
	s1 = string_source('2\n2\n4')
	pp(s1)
else:
	pp(input)


t = int(input())
for x in range(t):
	n = int(input())
	s1 = 0
	s2 = 0
	s1 += pow(2, n)
	for i in range(1, n // 2):
		s1 += pow(2, i)
	for i in range(n // 2, n):
		s2 += pow(2, i)
	print(abs(s1 - s2))


T = int(input())

def ans():
	n = int(input())
	total = 2 ** (n + 1) - 2
	a = 2 ** n + 2 ** (n // 2) - 2
	b = total - a
	return a - b
for t in range(T):
	print(ans())


t = int(input())
for i in range(t):
	n = int(input())
	mid = n // 2
	lg = 2 * (2 ** (mid - 1) - 1) + 2 ** n
	sm = 2 ** mid * (2 ** mid - 1)
	print(abs(lg - sm))


t = int(input())
for _ in range(t):
	n = int(input())
	(a, b) = (0, 0)
	for i in range(n):
		if i < n // 2 - 1 or i == n - 1:
			a += 2 ** (i + 1)
		else:
			b += 2 ** (i + 1)
	print(a - b)


for _ in range(int(input())):
	a = int(input())
	s = 0
	for i in range(1, int(a / 2) + 1):
		s = s + 2 ** i
	print(s)


for z in range(int(input())):
	n = int(input())
	lst = [2 ** x for x in range(1, n + 1)]
	k = n // 2
	print(lst[-1] + sum(lst[:k - 1]) - (sum(lst[k - 1:]) - lst[-1]))


t = int(input())
for _ in range(t):
	n = int(input())
	f = 0
	for i in range(1, int(n / 2)):
		f += 2 ** i
	f += 2 ** n
	s = 0
	for i in range(int(n / 2), n):
		s += 2 ** i
	print(abs(f - s))


import math
for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(2)
		continue
	else:
		a = [2 ** n] + [2 ** i for i in range(1, n // 2)]
		b = [2 ** (n - 1)] + [2 ** i for i in range(n // 2, n - 1)]
		print(sum(a) - sum(b))


result = []
for t in range(int(input())):
	n = int(input())
	a = 2 ** n + 2 ** (n // 2) - 2
	b = 2 ** (n + 1) - 2 - a
	result.append(abs(a - b))
for r in result:
	print(r)


for i in range(int(input())):
	n = int(input())
	if n == 2:
		print('2')
	else:
		Mult = []
		for i in range(1, n + 1):
			Mult.append(2 ** i)
		sum1 = 2 ** n
		sum2 = 0
		for i in range(0, n // 2 - 1):
			sum1 += Mult[i]
		for i in range(n // 2 - 1, n - 1):
			sum2 += Mult[i]
		print(abs(sum1 - sum2))


I = input
for _ in range(int(I())):
	n = int(input())
	if n == 2:
		print(2)
	else:
		c = 0
		for i in range(n - 1, n - 1 - n // 2, -1):
			c += 2 ** i
		a = 2 ** (n // 2) - 2
		a += 2 ** n
		print(abs(a - c))


for i in range(int(input())):
	n = int(input())
	s = 0
	t = 0
	for j in range(1, n // 2):
		s += 2 ** j
	for j in range(n // 2, n):
		t += 2 ** j
	s += 2 ** n
	print(abs(s - t))


t = int(input())
while t:
	t = t - 1
	n = int(input())
	(a, b) = (0, 0)
	a += 2 ** n
	for w in range(1, n // 2):
		a += 2 ** w
	for w in range(n // 2, n):
		b += 2 ** w
	print(abs(a - b))


import sys
input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7

def getlist():
	return list(map(int, input().split()))

def main():
	T = int(input())
	for i in range(T):
		N = int(input())
		M = int(N // 2)
		A = 0
		B = 0
		for j in range(1, M):
			A += 2 ** j
		A += 2 ** N
		for j in range(M, N):
			B += 2 ** j
		ans = A - B
		print(ans)
main()


from sys import stdin as inp
from sys import stdout as out
t = int(inp.readline())
for i in range(t):
	n = int(inp.readline())
	ans = 0
	for i in range(1, n // 2 + 1):
		ans += pow(2, i)
	out.write(str(ans) + '\n')


import math
n = int(input())
for i in range(n):
	a = int(input())
	print(int(math.pow(2, a / 2 + 1) - 2))


t = int(input())
for _ in range(t):
	n = int(input())
	half = int(n / 2)
	ls = 2 ** n + 2 * (2 ** (half - 1) - 1)
	rs = 2 ** half * (2 ** half - 1)
	print(abs(ls - rs))


t = int(input())
for i in range(0, t):
	n = int(input())
	c = 0
	c1 = 0
	for j in range(1, n // 2):
		c = c + 2 ** j
	c = c + 2 ** n
	for j in range(n // 2, n):
		c1 = c1 + 2 ** j
	print(c - c1)


import sys
from collections import defaultdict, deque
from math import sqrt, gcd, factorial

def input():
	return sys.stdin.readline()[:-1]

def solve():
	n = int(input())
	x = [2 ** e for e in range(1, n + 1)]
	sm = sum(x)
	a = x[-1]
	for i in range(0, n // 2 - 1):
		a += x[i]
	print(abs(sm - 2 * a))
t = 1
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	k = 2 ** n
	for i in range(1, n // 2):
		k += 2 ** i
	g = 0
	for j in range(n // 2, n):
		g += 2 ** j
	print(abs(k - g))


def min_diff(n):
	if n == 2:
		return 2
	A = [2 ** n]
	B = []
	for i in range(1, int(n / 2)):
		A.append(2 ** i)
	for i in range(int(n / 2), n):
		B.append(2 ** i)
	return abs(sum(A) - sum(B))
t = int(input())
for i in range(t):
	n = int(input())
	print(min_diff(n))


t = int(input())
for _ in range(t):
	n = int(input())
	x = [2 ** i for i in range(1, n + 1)]
	if len(x) == 2:
		print(2)
	else:
		print(sum(x[0:n // 2 - 1]) + x[-1] - sum(x[n // 2 - 1:-1]))


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		N = int(input())
		coins = [2 ** n for n in range(1, N + 1)]
		n = N // 2 - 1
		a = coins[-1] + sum(coins[:n])
		print(a * 2 - sum(coins))
main()


test_case = int(input())
my_list = []
for i in range(test_case):
	my_list.append(input())
	geometric = [2 * 2 ** (n - 1) for n in range(1, int(my_list[i]) + 1)]
	length = int(my_list[i]) / 2
	integer = int(length)
	total = geometric[-1]
	j = 1
	while j <= integer:
		total = total - geometric[-j - 1]
		j += 1
	k = 0
	while k <= integer - 2:
		total = total + geometric[k]
		k += 1
	print(total)


for i in range(int(input())):
	n = int(input())
	f = n // 2 + 1
	print((1 << f) - 2)


def Solve(nCase):
	n = int(input())
	print(abs(sum((2 ** x for x in range(1, n // 2))) + 2 ** n - sum((2 ** x for x in range(n // 2, n)))))
T = int(input())
for i in range(1, T + 1):
	Solve(i)


t = int(input())
for _ in range(t):
	n = int(input())
	x = 2 * (2 ** n - 1)
	y = 2 ** n + 2 * (2 ** (n // 2 - 1) - 1)
	print(abs(x - 2 * y))


t = int(input())
for __ in range(t):
	n = int(input())
	li = [2 ** i for i in range(1, n + 1)]
	sa = 0
	sb = li[-1]
	for i in range(n - 1):
		if i < n // 2 - 1:
			sb += li[i]
		else:
			sa += li[i]
	print(abs(sa - sb))


def main(n):
	lista = []
	cont = 0
	for y in range(1, n + 1):
		lista.append(2 ** y)
	l1 = []
	l2 = []
	l1.append(lista[-1])
	while len(l1) != n / 2:
		l1.append(lista[cont])
		cont += 1
	for _ in lista:
		if _ not in l1:
			l2.append(_)
	result = abs(sum(l2) - sum(l1))
	return result
test = int(input())
respostas = []
for x in range(test):
	n = int(input())
	respostas.append(main(n))
for x in respostas:
	print(x)


for _ in range(int(input())):
	n = int(input())
	a = []
	s = 0
	for i in range(1, n + 1):
		a.append(2 ** i)
	s += sum(a[n // 2:-1]) + a[n // 2 - 1]
	print(sum(a) - 2 * s)


t = int(input())
for _ in range(t):
	n = int(input())
	dif = 0
	for i in range(1, n // 2):
		dif += 2 ** i
	dif += 2 ** n
	for i in range(n // 2, n - 1):
		dif = dif - 2 ** i
	dif = dif - 2 ** (n - 1)
	print(abs(dif))


t = int(input())
for i in range(t):
	n = int(input())
	s = []
	for k in range(1, n + 1):
		s.append(2 ** k)
	if n == 2:
		print(s[1] - s[0])
	else:
		k = n // 2
		a = sum(s[:k - 1]) + s[n - 1]
		b = sum(s[k - 1:n - 1])
		print(abs(a - b))


from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 200010
MOD = 10 ** 9 + 7
spf = [i for i in range(MAXN)]
spf[0] = spf[1] = -1

def sieve():
	for i in range(2, MAXN, 2):
		spf[i] = 2
	for i in range(3, int(MAXN ** 0.5) + 1):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def fib(n, m):
	if n == 0:
		return [0, 1]
	else:
		(a, b) = fib(n // 2)
		c = a % m * (b % m * 2 - a % m) % m
		d = a % m * (a % m) % m + b % m * b % m % m
		if n % 2 == 0:
			return [c, d]
		else:
			return [d, c + d]

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def ncr(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % MOD
		den = den * (i + 1) % MOD
	return num * pow(den, MOD - 2, MOD) % MOD

def flush():
	return sys.stdout.flush()
for _ in range(int(input())):
	n = int(input())
	a = [1 << i for i in range(1, n + 1)]
	if n == 2:
		print(2)
	else:
		s1 = s2 = 0
		s1 += a.pop() + a.pop(0)
		a = a[::-1]
		s2 = sum(a[:n // 2])
		s1 += sum(a[n // 2:])
		print(abs(s1 - s2))


for _ in range(int(input())):
	n = int(input())
	l = 0
	r = 0
	t = 1 + 1
	for i in range(n // (1 + 1) - 1):
		l += t
		t *= 1 + 1
	for i in range(n // (1 + 1)):
		r += t
		t *= 1 + 1
	l += (1 + 1) ** n
	print(abs(r - l))


T = int(input())
for case in range(T):
	N = int(input())
	a = []
	b = []
	if N > 2:
		b.append(2 ** N)
		for i in range(1, N // 2):
			b.append(2 ** i)
		for j in range(N - 1, N // 2 - 1, -1):
			a.append(2 ** j)
		print(abs(sum(a) - sum(b)))
	else:
		print(2)


t = int(input())

def minDiff(a):
	li = []
	for i in range(1, a + 1):
		li.append(2 ** i)
	z = li[-1] + sum(li[:int(a / 2) - 1])
	x = sum(li[int(a / 2) - 1:a - 1])
	return abs(z - x)
for i in range(t):
	n = int(input())
	print(minDiff(n))


res = dict()
x = 4
y = 1
while x <= 30:
	res[x] = y
	x += 2
	y += 1
k = int(input())
for i in range(k):
	n = int(input())
	a = 0
	b = 0
	if n == 2:
		print(2)
	else:
		for j in range(1, res[n] + 1):
			a += 1 << j
		a += 1 << n
		for j in range(res[n] + 1, n):
			b += 1 << j
		print(abs(a - b))


import math
import array
arr1 = array.array('l', [])
arr2 = array.array('l', [])
for i in range(0, 31, 1):
	a = int(math.pow(2, i))
	arr2.append(a)
p = input()
n = int(p)
for i in range(0, n, 1):
	kk = input()
	x = int(kk)
	r = int(x / 2)
	a1 = arr2[x]
	for i in range(1, r, 1):
		a1 = a1 + arr2[i]
	a2 = 0
	for i in range(r, x, 1):
		a2 = a2 + arr2[i]
	dd = int(abs(a1 - a2))
	print(dd)


t = int(input())
for x in range(t):
	n = int(input())
	ans = 2
	for i in range(int(n / 2) - 1):
		ans += ans + 2
	print(ans)


T = int(input())
for t in range(T):
	n = int(input())
	A = 0
	B = 0
	for i in range(1, int(n / 2)):
		A += 2 ** i
	for i in range(int(n / 2), n):
		B += 2 ** i
	print(2 ** n + A - B)


def list_int():
	return list(map(int, input().split()))

def int_in():
	return int(input())

def map_in():
	return map(int, input().split())

def list_in():
	return input().split()
t = int_in()
for i in range(t):
	n = int_in()
	x1 = 2 ** n - 2 ** (n // 2)
	x2 = 2 ** (n // 2) - 2 + 2 ** n
	print(abs(x1 - x2))


(t, _) = (int(input()), 0)
while _ < t:
	(n, l) = (int(input()), [])
	for i in range(1, n + 1):
		l.append(2 ** i)
	x = l[n // 2 - 1:n - 1]
	l = l[:n // 2 - 1] + l[n - 1:]
	print(sum(l) - sum(x))
	_ += 1


t = int(input())
for _ in range(t):
	n = int(input())
	s1 = 0
	s2 = 0
	s1 += 2 ** n
	for i in range(1, n // 2):
		s1 += 2 ** i
	for i in range(n // 2, n):
		s2 += 2 ** i
	print(abs(s1 - s2))


import sys
input = sys.stdin.readline

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	s = input()
	return list(s[:len(s) - 1])
t = int(input())
for q in range(t):
	n = inputnum()
	n = n // 2 + 1
	ans = 2 ** n - 2
	print(ans)


for i in range(int(input())):
	n = int(input())
	l = []
	for j in range(1, n + 1):
		l.append(2 ** j)
	c = n // 2 - 1
	a = sum(l[0:c]) + l[-1]
	b = sum(l[c:n - 1])
	print(abs(a - b))


r = int(input())
for i in range(r):
	n = int(input())
	list = []
	l1 = []
	l2 = []
	for i in range(n):
		list.append(2 ** (i + 1))
	if n / 2 % 2 != 0:
		for i in range(int(n / 2 - 1)):
			l1.append(list[i])
		l1.append(list[-1])
		for i in range(int(n / 2 - 1), n - 1):
			l2.append(list[i])
	else:
		for i in range(int(n / 2 - 1)):
			l1.append(list[i])
		l1.append(list[-1])
		for i in range(int(n / 2 - 1), n - 1):
			l2.append(list[i])
	print(sum(l1) - sum(l2))


for _ in range(int(input())):
	n = int(input())
	k = 1
	s = 0
	s1 = 0
	l = []
	p = 0
	for i in range(n):
		k = k * 2
		l.append(k)
	c = 0
	for i in range(n - 1, -1, -1):
		if i == n - 1:
			s += l[i]
		if s1 < s and c < n // 2:
			s1 += l[i]
			c += 1
		else:
			s += l[i]
			p += 1
	print(abs(s1 - s))


test_cases = int(input())
for _ in range(test_cases):
	n = int(input())
	first_sum = pow(2, n // 2) - 2 + pow(2, n)
	second_sum = pow(2, n) - pow(2, n // 2)
	print(abs(first_sum - second_sum))


def main():
	from bisect import bisect_left as bl, bisect_right as br, insort
	import sys, heapq, math
	from collections import defaultdict as dd, deque

	def data():
		return sys.stdin.readline().strip()

	def mdata():
		return list(map(int, data().split()))
	out = sys.stdout.write
	INF = int(1000000000.0)
	mod = int(1000000000.0) + 7
	for i in range(int(data())):
		n = int(input())
		ans = pow(2, n // 2 + 1) - 2
		print(ans)
main()


a = [2 ** (x + 1) for x in range(30)]
for _ in range(int(input())):
	b = int(input())
	(n, m) = (0, 0)
	c = b // 2
	(l, r) = (0, b - 1)
	left = True
	n = a[r]
	r -= 1
	c -= 1
	while c != 0:
		n += a[l]
		l += 1
		c -= 1
	while l <= r:
		m += a[l]
		l += 1
	print(abs(n - m))


t = int(input())
while t > 0:
	n = int(input())
	l = r = 0
	for i in range(1, n // 2):
		l = l + pow(2, i)
	l = l + pow(2, n)
	for i in range(n // 2, n):
		r = r + pow(2, i)
	print(abs(l - r))
	t = t - 1


t = int(input())
for i in range(t):
	n = int(input())
	s = 2 ** n
	s1 = 0
	for i in range(1, n // 2):
		s += 2 ** i
	for i in range(n // 2, n):
		s1 += 2 ** i
	print(s - s1)


tt = int(input())
while tt:
	tt += -1
	n = int(input())
	t = n // 2
	s1 = 0
	for i in range(1, t):
		s1 += 2 ** i
	s1 += 2 ** n
	s2 = 0
	for i in range(t, n):
		s2 += 2 ** i
	print(abs(s1 - s2))


import operator
import math

def res(n):
	nums = []
	for i in range(1, n + 1):
		nums.append(math.pow(2, i))
	half = math.pow(2, n + 1) / 2
	counts = [n / 2, n / 2]
	sums = [0, 0]
	countB = n / 2
	while True:
		currentPile = None
		currentCount = None
		if len(nums) == 0:
			break
		big = max(nums)
		if sums[0] > sums[1] and counts[1] > 0:
			sums[1] += big
			counts[1] -= 1
		elif counts[0] > 0:
			sums[0] += big
			counts[0] -= 1
		elif counts[1] > 0:
			sums[1] += big
			counts[1] -= 1
		else:
			break
		nums.remove(big)
	return int(abs(sums[0] - sums[1]))
a = []
cases = int(input())
for c in range(cases):
	a.append(int(input()))
for case in a:
	print(res(case))


tests = int(input())
while tests > 0:
	n = int(input())
	coins = []
	for i in range(1, n + 1):
		coins.append(pow(2, i))
	smallerPile = sum(coins[n // 2 - 1:n // 2 - 1 + n // 2])
	print(sum(coins) - smallerPile - smallerPile)
	tests = tests - 1


t = int(input())
for i in range(t):
	n = int(input())
	sol = 2 ** ((n + 2) // 2) - 2
	print(sol)


def c_weights(n):
	w = []
	for i in range(1, n + 1):
		w.append(2 ** i)
	return w

def c_dist(n):
	a = []
	b = []
	for i in range(len(n)):
		if i <= len(n) // 2 - 2 or i == len(n) - 1:
			a.append(n[i])
		else:
			b.append(n[i])
	if sum(a) - sum(b) > 0:
		return sum(a) - sum(b)
	else:
		return sum(b) - sum(a)
t = int(input())
n = []
for i in range(t):
	n.append(int(input()))
for i in range(t):
	lst = c_weights(n[i])
	print(c_dist(lst))


from sys import stdin, stdout
import math

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		s1 = 0
		s2 = 0
		for i in range(1, n // 2):
			s1 += 2 ** i
		s1 += 2 ** n
		for j in range(n // 2, n):
			s2 += 2 ** j
		print(abs(s1 - s2))
main()


n = int(input())
i = 1
while i <= n:
	x = int(input())
	a = x / 2 + 1
	b = 2 ** a
	b -= 2
	print(int(b))
	i += 1


for _ in range(int(input())):
	n = int(input())
	l = [2 ** i for i in range(1, n + 1)]
	sum_a = 0
	sum_b = 0
	for i in range(n // 2 - 1):
		sum_a += l[i]
	sum_a += l[n - 1]
	for i in range(n // 2 - 1, n - 1):
		sum_b += l[i]
	print(sum_a - sum_b)


t = int(input())
for t1 in range(t):
	k = int(input())
	sumSmall = pow(2, k // 2) - 2
	print(2 * sumSmall + 2)


t = int(input())
for i in range(t):
	n = int(input())
	l = [2 ** i for i in range(1, n // 2)]
	l1 = [2 ** i for i in range(n // 2, n)]
	print(2 ** n + sum(l) - sum(l1))


from sys import stdin, exit, setrecursionlimit
from collections import deque
setrecursionlimit(10000000)
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
arr = [1]
for i in range(31):
	arr.append(arr[-1] * 2)
for _ in range(int(input())):
	n = int(input())
	s = 0
	b = 0
	for i in range(1, n + 1):
		s += arr[i]
	for i in range(1, n // 2, 1):
		b += arr[i]
	b += arr[n]
	print(abs(s - b - b))


t = int(input())
for _ in range(t):
	n = int(input())
	i = 1
	ans1 = 2 ** n
	ans2 = 0
	while i <= n // 2 - 1:
		ans1 += 2 ** i
		i += 1
	i = n // 2
	while i < n:
		ans2 = ans2 + 2 ** i
		i += 1
	print(abs(ans1 - ans2))


t = int(input(''))
while t >= 1:
	a = int(input(''))
	r = int(a / 2) + 1
	p = 2 ** r - 2
	print(p)
	t = t - 1


q = int(input())
for _ in range(q):
	c = []
	f = []
	r = int(input())
	for i in range(1, r + 1):
		f.append(2 ** i)
	c.append(f[-1])
	f.pop(-1)
	c += f[:r // 2 - 1]
	g = f[r // 2 - 1:]
	print(sum(c) - sum(g))


t = int(input())

def helper(n):
	a = 0
	b = 0
	count = 0
	i = n
	while i >= 1:
		if i == n:
			a += 2 ** i
			i -= 1
			continue
		if count < n / 2:
			b += 2 ** i
			count += 1
			i -= 1
			continue
		else:
			a += 2 ** i
			i -= 1
	return abs(a - b)
while t > 0:
	n = int(input())
	print(helper(n))
	t -= 1


def solve(n):
	pile1 = pile2 = 0
	pile1 += 1 << n
	for i in range(1, int(n / 2)):
		pile1 += 1 << i
	for i in range(int(n / 2), n):
		pile2 += 1 << i
	return pile1 - pile2
t = int(input())
results = list()
for i in range(0, t):
	n = int(input())
	results.append(solve(n))
for result in results:
	print(result)


t = int(input())
p = [2 ** i for i in range(31)]
while t != 0:
	n = int(input())
	x = p[n] + sum(p[1:n // 2])
	y = sum(p[1:n + 1]) - x
	print(x - y)
	t = t - 1


t = int(input())
for tt in range(t):
	l = []
	L = []
	al = []
	n = int(input())
	for i in range(1, n + 1):
		al.append(2 ** i)
	L.append(al[-1])
	l.append(al[-2])
	for i in range(1, round((n - 2) / 2) + 1):
		L.append(2 ** i)
	for i in range(round((n - 2) / 2) + 1, n - 1):
		l.append(2 ** i)
	print(sum(L) - sum(l))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def from_file(f):
	return f.readline
t = inp()
for _ in range(t):
	n = inp()
	h = n // 2
	shm = 2 ** h - 1 - 1
	res = 2 * (2 ** n + shm) - (2 ** (n + 1) - 2)
	print(res)


t = int(input())
for ti in range(t):
	n = int(input())
	n = n // 2 + 1
	print((1 << n) - 2)


p2 = [pow(2, x) for x in range(1, 31)]
t = int(input())
while t > 0:
	n = int(input())
	r = p2[:n][::-1]
	g1 = 0
	g2 = 0
	g1c = 0
	g2c = 0
	idx = 0
	c = n // 2
	for (i, k) in enumerate(r):
		if g1c == c or g2c == c:
			idx = i
			break
		if g1 < g2:
			g1 += k
			g1c += 1
		else:
			g2 += k
			g2c += 1
	for k in r[idx:]:
		if g2c != c:
			g2 += k
		else:
			g1 += k
	print(abs(g1 - g2))
	t -= 1


for _ in range(int(input())):
	n = int(input())
	(p1, p2) = (0, 0)
	curr = pow(2, n)
	p1 = curr
	curr /= 2
	for i in range(n // 2):
		p2 += curr
		curr /= 2
	for i in range(1, n // 2):
		p1 += curr
		curr /= 2
	print(int(abs(p1 - p2)))


N = int(input())
arr = []
for i in range(N):
	x = int(input())
	if x == 2:
		arr.append(2)
	if x == 4:
		arr.append(6)
	if x == 6:
		arr.append(14)
	if x > 6:
		x1 = 2 ** x + sum([2 ** k for k in range(1, x // 2)])
		x2 = sum([2 ** k for k in range(x // 2, x)])
		arr.append(x1 - x2)
for i in arr:
	print(i)


N = int(input())
weights = None
for i in range(N):
	coins = int(input())
	weights = [2 ** i for i in range(1, coins + 1)]
	i = coins - 1
	pile1 = pile2 = 0
	for _ in range(coins // 2):
		pile1 += weights[i]
		i = (i + 1) % coins
	for _ in range(coins // 2):
		pile2 += weights[i]
		i = (i + 1) % coins
	print(abs(pile1 - pile2))


t = int(input())
for i in range(t):
	n = int(input())
	p = 0
	for j in range(1, n // 2 + 1):
		p = p + 2 ** j
		j = j + 1
	print(p)


for _ in range(int(input())):
	n = int(input())
	z = []
	s = 1 << n
	s1 = 0
	for i in range(1, n // 2):
		s += 1 << i
	for i in range(n // 2, n):
		s1 += 1 << i
	print(s - s1)


l = [2, 6, 14, 30, 62, 126, 254, 510, 1022, 2046, 4094, 8190, 16382, 32766, 65534]
t = int(input())
for _ in range(t):
	n = int(input())
	a = n // 2 - 1
	print(l[a])


for t in range(int(input())):
	n = int(input())
	ans = 2 ** (n // 2 + 1) - 2
	print(ans)


def main():
	n = int(input())
	add1 = 0
	add2 = 0
	dp = [0 for _ in range(30)]
	temp = 2
	for i in range(n):
		dp[i] = temp
		temp = temp * 2
	add1 = dp[n - 1] + sum(dp[:n // 2 - 1])
	add2 = sum(dp[n // 2 - 1:n - 1])
	print(add1 - add2)
t = int(input())
while t:
	main()
	t -= 1


count = int(input())
while count > 0:
	n = int(input())
	s1 = pow(2, n)
	s2 = 0
	for x in range(1, n // 2):
		s1 += pow(2, x)
	for x in range(n // 2, n):
		s2 += pow(2, x)
	print(s1 - s2)
	count = count - 1


for _ in range(int(input())):
	n = int(input())
	ans = 2 ** n
	if n == 2:
		print(2)
		continue
	for i in range(1, n // 2):
		ans += 2 ** i
	ans1 = 0
	for i in range(n // 2, n):
		ans1 += 2 ** i
	print(abs(ans - ans1))


import math
n = int(input())
for i in range(n):
	power = int(input())
	print(int(2 ** (power / 2 + 1) - 2))


t = input()
t = int(t)
while t > 0:
	x = input()
	x = int(x)
	i = 1
	j = 0
	n = x
	sum1 = 2 ** n
	n = n - 1
	sum2 = 0
	while i < int(x / 2) and j < int(x / 2):
		if sum2 + 2 ** n < sum1:
			sum2 = sum2 + 2 ** n
			j = j + 1
		else:
			sum1 = sum1 + 2 ** n
			i = i + 1
		n = n - 1
	if i == x / 2:
		while n > 0:
			sum2 = sum2 + 2 ** n
			n = n - 1
	else:
		while n > 0:
			sum1 = sum1 + 2 ** n
			n = n - 1
	ans = abs(sum1 - sum2)
	print(ans)
	t = t - 1


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	N = Scanner.int()
	tmp = 2
	L = [2 ** i for i in range(1, N + 1)]
	A = sum(L[:N // 2 - 1]) + L[-1]
	B = sum(L) - A
	print(A - B)

def main():
	T = Scanner.int()
	for _ in range(T):
		solve()
main()


l = []
for i in range(1, 31):
	l.append(2 ** i)
for t in range(int(input())):
	n = int(input())
	m = l[:n][::-1]
	(one, two) = ([m[0]], [])
	for i in range(1, len(m)):
		if i <= n // 2:
			two.append(m[i])
		else:
			one.append(m[i])
	print(sum(one) - sum(two))


import sys
input = sys.stdin.readline
A = [1 << i for i in range(1, 50)]
t = int(input())
for tests in range(t):
	n = int(input())
	SUM = sum(A[:n])
	B = A[n - 1]
	for i in range(n // 2 - 1):
		B += A[i]
	print(B - (SUM - B))


num = int(input())
for i in range(num):
	n = int(input())
	lis = []
	for i in range(1, n + 1):
		z = (lambda x: 2 ** x)(i)
		lis.append(z)
	l1 = lis[:n // 2]
	l2 = lis[n // 2:]
	ma = max(l1)
	ma2 = max(l2)
	print(sum(l1) - ma + ma2 - (sum(l2) + ma - ma2))


import sys
import math
import bisect

def solve(n):
	a = 0
	b = 0
	for i in range(1, n + 1):
		val = 2 ** i
		if i == n:
			b += val
		elif i <= n // 2 - 1:
			b += val
		else:
			a += val
	return b - a

def main():
	for _ in range(int(input())):
		n = int(input())
		print(solve(n))
main()


t = int(input())
for k in range(1, t + 1):
	n = int(input())
	s1 = 2 ** n
	for a in range(1, n // 2):
		b = 2 ** a
		s1 += b
	s2 = 0
	for i in range(n // 2, n):
		c = 2 ** i
		s2 += c
	print(s1 - s2)


import sys

def main(n):
	return 2 ** (n // 2 + 1) - 2
t = sys.stdin.readline()
for i in range(int(t)):
	n = int(sys.stdin.readline())
	print(main(n))


def solve():
	N = int(input())
	(a, b) = (0, 0)
	for i in range(1, N + 1):
		if i < N // 2 or i == N:
			a += 2 ** i
		else:
			b += 2 ** i
	return abs(a - b)
for t in range(1, int(input()) + 1):
	print(solve())


import sys
from collections import defaultdict
from copy import copy
R = lambda t=int: t(input())
RL = lambda t=int: [t(x) for x in input().split()]
RLL = lambda n, t=int: [RL(t) for _ in range(n)]

def solve():
	n = R()
	x = [2 ** i for i in range(1, n)]
	a = sum([2 ** n] + x[:n // 2 - 1])
	b = sum(x[n // 2 - 1:])
	print(a - b)
T = R()
for _ in range(T):
	solve()


for _ in range(int(input())):
	n = int(input())
	a = [0, 0]
	a[0] += pow(2, n) + pow(2, int(n / 2)) - 2
	a[1] += pow(2, int(n / 2)) * (pow(2, int(n / 2)) - 1)
	print(a[0] - a[1])


t = int(input())
for i in range(t):
	n = int(input())
	sum = 0
	for j in range(1, n + 1):
		if j < n // 2 or j == n:
			sum += 2 ** j
		else:
			sum -= 2 ** j
	print(abs(sum))


for _ in range(int(input())):
	n = int(input())
	a = [2 ** i for i in range(1, n + 1)]
	print(abs(sum(a) - 2 * (a[-1] + sum(a[:len(a) // 2 - 1]))))


t = int(input())
res = []
for i in range(t):
	n = int(input())
	l = [2 ** i for i in range(1, n + 1)]
	a = l[-1] + sum(l[:n // 2 - 1])
	b = sum(l[n // 2 - 1:-1])
	res.append(a - b)
for el in res:
	print(el)


import math
t = int(input())
for q in range(t):
	n = int(input())
	arr = [2 ** (i + 1) for i in range(n)]
	a = 0
	b = sum(arr)
	for i in range(n // 2, n):
		a += 2 ** i
	b -= a
	print(abs(a - b))


for _ in range(int(input())):
	n = int(input())
	arr = [0] * 2
	i = 1
	j = n
	cnt = 0
	s = 2 ** n + sum((2 ** i for i in range(1, n // 2)))
	total_s = sum((2 ** i for i in range(1, n + 1)))
	print(2 * s - total_s)


for _ in range(int(input())):
	n = int(input())
	l = [pow(2, i) for i in range(1, n + 1)]
	print(abs(sum(l[:n // 2 - 1]) + l[-1] - sum(l[n // 2 - 1:n - 1])))


t = int(input())
for _ in range(t):
	n = int(input())
	a = b = d = 0
	for i in range(1, n // 2):
		a += 2 ** i
	a += 2 ** n
	for i in range(n // 2, n):
		b += 2 ** i
	d = abs(a - b)
	print(d)


t = int(input())
for i in range(t):
	n = int(input())
	ma = 2 ** n
	(p1, p2) = (0, 0)
	for j in range(1, n):
		if j < n / 2:
			p1 = p1 + 2 ** j
		elif j >= n / 2:
			p2 = p2 + 2 ** j
	diff = p1 + ma - p2
	print(diff)


t = int(input())
for w in range(t):
	n = int(input()) // 2
	print(2 ** (n + 1) - 2)


t = int(input())
vals = list(range(2, 56, 2))
for case in range(t):
	n = int(input())
	print(2 ** (vals.index(n) + 2) - 2)


for _ in range(int(input())):
	n = int(input())
	a = []
	for i in range(1, n + 1):
		a.append(2 ** i)
	l = sum(a[:n // 2 - 1]) + a[n - 1]
	r = sum(a[n // 2 - 1:n - 1])
	print(l - r)


for x in range(int(input())):
	print((2 ** (int(input()) // 2) - 1) * 2)


t = int(input())
for i in range(t):
	n = int(input())
	s = [2 ** i for i in range(1, n + 1)]
	d = s[n // 2 - 1:n - 1]
	del s[n // 2 - 1:n - 1]
	print(abs(sum(d) - sum(s)))


def solve():
	n = int(input())
	a = 2 ** n
	b = 0
	for i in range(n // 2):
		a += 2 ** i
	for i in range(n // 2, n):
		b += 2 ** i
	print(a - b - 1)
t = int(input())
for i in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	x = []
	y = []
	for i in range(int(n / 2 - 1)):
		x.append(2 ** (i + 1))
	x.append(2 ** n)
	for i in range(int(n / 2), int(n)):
		y.append(2 ** i)
	sum_x = 0
	sum_y = 0
	for _ in x:
		sum_x += _
	for _ in y:
		sum_y += _
	print(abs(sum_x - sum_y))


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	p = n // 2
	s1 = 0
	s2 = 0
	for i in range(1, p):
		s1 += 2 ** i
	s1 = s1 + 2 ** n
	for i in range(p, n):
		s2 = s2 + 2 ** i
	ans.append(s1 - s2)
for i in ans:
	print(i)


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(1, n + 1):
		l.append(pow(2, i))
	x = l[-1] + sum(l[:n // 2 - 1])
	y = sum(l[n // 2 - 1:-1])
	print(abs(x - y))


def main_function():
	from sys import stdin
	from sys import stdout
	input = stdin.readline
	print = stdout.write
	t = int(input())
	for _ in range(t):
		n = int(input())
		(a, b) = (pow(2, n), 0)
		for i in range(1, n):
			if i > n // 2 - 1:
				b += pow(2, i)
			else:
				a += pow(2, i)
		print(f'{a - b}\n')
main_function()


tc = int(input())
cases = []
for _ in range(tc):
	cases.append(int(input()))
for num_coins in cases:
	weights = []
	for i in range(1, num_coins + 1):
		weights.append(2 ** i)
	first_pile = weights[:num_coins // 2 - 1]
	first_pile.append(weights[-1])
	second_pile = weights[num_coins // 2 - 1:-1]
	print(sum(first_pile) - sum(second_pile))


n = int(input())
L = [0] * n
for i in range(n):
	L[i] = int(input())
for j in L:
	j //= 2
	ans = 2 ** (j + 1) - 2
	print(ans)


n = int(input())
lst = []
for j in range(n):
	cmd = int(input())
	lst.append(cmd)
for i in lst:
	main = []
	for j in range(1, i + 1):
		wg = 2 ** j
		main.append(wg)
	l = 0
	r = 0
	half = i // 2
	for k in range(half - 1):
		val = main[k]
		l += val
	l += main[i - 1]
	for m in range(half - 1, i - 1):
		rgt = main[m]
		r += rgt
	print(abs(l - r))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [1 << i for i in range(1, n + 1)]
	mid = n // 2
	a = arr[-1] + sum(arr[:mid - 1])
	b = sum(arr[mid - 1:n - 1])
	print(a - b)


def solve(n):
	max_num = 2 ** n
	min_sum = 0
	for i in range(1, n // 2):
		max_num = max_num + 2 ** i
	for j in range(n // 2, n):
		min_sum = min_sum + 2 ** j
	print(max_num - min_sum)
test_case = int(input())
while test_case != 0:
	n = int(input())
	solve(n)
	test_case = test_case - 1


import math
t = int(input())
temp = []
for i in range(30):
	temp.append(math.pow(2, i + 1))
for z in range(t):
	n = int(input())
	print(int(abs(sum(temp[n // 2 - 1:n - 1]) - (sum(temp[:n // 2 - 1]) + temp[n - 1]))))


inp1 = int(input())
lst = []
for i in range(0, inp1):
	ele = int(input())
	lst.append(ele)
p = max(lst)
lst1 = []
for i in range(1, p + 1):
	j = 2 ** i
	lst1.append(j)
for i in lst:
	a1 = lst1[i - 1] + sum(lst1[0:int(i / 2 - 1)])
	a2 = sum(lst1[int(i / 2 - 1):i - 1])
	print(a1 - a2)


t = int(input())
for i in range(t):
	n = int(input())
	arr = [2 ** n for n in range(1, n + 1)]
	print(sum(arr[:n // 2 - 1] + arr[-1:]) - sum(arr[n // 2 - 1:-1]))


arr = {2: 2, 4: 6, 6: 14, 8: 30, 10: 62, 12: 126, 14: 254, 16: 510, 18: 1022, 20: 2046, 22: 4094, 24: 8190, 26: 16382, 28: 32766, 30: 65534}
for _ in range(int(input())):
	n = int(input())
	print(arr[n])


t = int(input())
for _ in range(t):
	a = int(input())
	c = 0
	d = 0
	for i in range(1, a + 1):
		if i < a / 2 or i == a:
			c = c + 2 ** i
		if a / 2 <= i <= a - 1:
			d = d + 2 ** i
	print(c - d)


def solve(n):
	half = n // 2
	a = 2 ** n
	b = 0
	for i in range(1, half):
		a = a + 2 ** i
	for i in range(half, n):
		b = b + 2 ** i
	return abs(a - b)
t = int(input())
for _ in range(t):
	n = int(input())
	print(solve(n))


n = int(input())
while n > 0:
	n -= 1
	x = int(input())
	print((1 << x // 2 + 1) - 2)


import sys
import math
from collections import defaultdict

def solve(t):
	n = int(input())
	first = 2 ** n
	second = 0
	for i in range(1, n // 2):
		first += 2 ** i
	for i in range(n // 2, n):
		second += 2 ** i
	print(first - second)
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


for _ in range(int(input())):
	n = int(input())
	p = [2 ** i for i in range(1, n + 1)]
	a = p[-1]
	b = p[-2]
	aa = p[0:int((n - 2) / 2)]
	bb = p[int((n - 2) / 2):n - 2]
	a += sum(aa)
	b += sum(bb)
	print(abs(a - b))


T = int(input())
for _ in range(T):
	n = int(input())
	B = 2 ** n
	A = 0
	for i in range(1, n):
		if i < n // 2:
			B += 2 ** i
		else:
			A += 2 ** i
	print(abs(A - B))


for _ in range(int(input())):
	t = int(input())
	part1 = pow(2, t)
	part2 = 0
	con = 1
	n = 1
	m = t
	flag = True
	for i in range(1, t):
		if con != t // 2:
			part1 += pow(2, i)
			con += 1
		else:
			part2 += pow(2, i)
	print(part1 - part2)


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	for i in range(n):
		k = 2 ** (i + 1)
		a.append(k)
	s = a[-1]
	for i in range(n // 2 - 1):
		s += a[i]
	f = 0
	for j in range(n // 2 - 1, n - 1):
		f += a[j]
	print(s - f)


t = int(input())
for _ in range(t):
	n = int(input())
	li = []
	for i in range(1, n + 1):
		li.append(pow(2, i))
	t1 = []
	t2 = []
	t1.append(li[len(li) - 1])
	for i in range(n // 2 - 1):
		t1.append(li[i])
	for i in range(n // 2 - 1, n - 1):
		t2.append(li[i])
	s = abs(sum(t1) - sum(t2))
	print(s)


for _ in range(int(input())):
	n = int(input())
	pile1 = [pow(2, n)]
	pile2 = []
	for i in range(1, n // 2):
		pile1.append(pow(2, i))
	for i in range(n // 2, n):
		pile2.append(pow(2, i))
	print(sum(pile1) - sum(pile2))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = []
	s = 0
	for i in range(1, n + 1):
		a.append(2 ** i)
	s += a.pop()
	for i in range(n // 2 - 1):
		s += a.pop(0)
	print(abs(sum(a) - s))


def task(n):
	suma = 1
	arr = []
	for i in range(0, n):
		suma *= 2
		arr.append(suma)
	a = 0
	b = 0
	while len(arr) > 0:
		if a <= b:
			a += arr.pop()
			b += arr.pop()
		else:
			a += arr.pop(0)
			b += arr.pop()
	diff = abs(a - b)
	print(diff)
t = int(input())
for i in range(0, t):
	n = int(input())
	task(n)


from itertools import permutations

def ans(a):
	x = a
	y = a
	l = []
	f = 0
	sum = 0
	count = 0
	for i in range(1, x + 1, 1):
		f = pow(2, i)
		l.append(f)
	for i in range(0, len(l) // 2, 1):
		count += l[i]
	for i in range(y // 2, len(l) - 1, 1):
		sum += l[i]
	print(count)
t = int(input())
while t > 0:
	a = int(input())
	ans(a)
	t -= 1


import io
import os
from itertools import combinations
DEBUG = False

def solve(N):
	total = 2 ** (N + 1) - 2
	a = 2 ** N + (2 ** (N // 2) - 2)
	b = total - a
	ans = abs(a - b)
	if DEBUG:
		print('ans', ans, total, a, b)
		best = (float('inf'),)
		for comb in combinations(range(1, N + 1), r=N // 2):
			total = sum((1 << i for i in range(1, N + 1)))
			a = sum((1 << i for i in comb))
			b = total - a
			cost = abs(a - b)
			best = min(best, (cost, comb))
		print('best', n, best)
		assert best[0] == ans
	return ans
if DEBUG:
	for n in range(2, 31, 2):
		solve(n)
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N,) = [int(x) for x in input().split()]
	ans = solve(N)
	print(ans)


n = int(input())
for i in range(n):
	s1 = 0
	s2 = 0
	m = int(input())
	for j in range(1, m // 2):
		s1 += 2 ** j
	for j in range(m // 2, m):
		s2 += 2 ** j
	s1 += 2 ** m
	print(s1 - s2)


for _ in range(int(input())):
	n = int(input())
	res = 2 ** (n + 1) - 2
	res -= 2 * sum((2 ** x for x in range(n // 2, n)))
	print(res)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	nums = [int(input()) for x in range(t)]
	for n in nums:
		print(2 * (2 ** (n // 2) - 1))
main()


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	val = 2
	for j in range(n):
		l.append(val)
		val = val * 2
	p1 = l[-1]
	p2 = l[-2]
	l = l[:n - 2]
	p1 += sum(l[:len(l) // 2])
	p2 += sum(l[len(l) // 2:])
	print(abs(p1 - p2))


t = int(input())
for _ in range(t):
	n = int(input())
	a = 2 ** n
	for k in range(1, n // 2):
		a += 2 ** k
	b = 0
	for k in range(n // 2, n):
		b += 2 ** k
	print(abs(a - b))


for _ in range(int(input())):
	n = int(input())
	l = [2 ** i for i in range(1, n + 1)]
	k = n // 2
	a = l[-1] + sum(l[0:k - 1])
	b = sum(l) - a
	print(abs(a - b))


def fun(n):
	a = 2 ** n + 2 * (2 ** (n // 2 - 1) - 1)
	b = 2 * (2 ** n - 1)
	c = abs(b - 2 * a)
	print(c)
t = int(input())
for _ in range(t):
	n = int(input())
	fun(n)


for _ in range(int(input())):
	n = int(input())
	te = n // 2
	res = 0
	for i in range(1, te + 1):
		res += pow(2, i)
	print(res)


q = int(input())
for _ in range(q):
	n = int(input())
	s = 2 ** n - 1
	m = 0
	for st in range(n, 0, -1):
		t = 0
		c = 0
		for d in range(st, 0, -1):
			if t + 2 ** d <= s:
				t += 2 ** d
				c += 1
			if c == n // 2:
				break
		if c == n // 2:
			m = max(t, m)
	print(2 * (s - m))


for _ in range(int(input())):
	n = int(input())
	l = [2 ** x for x in range(1, n + 1)]
	(x, y) = (sum(l[:n // 2 - 1]) + l[-1], sum(l[n // 2 - 1:]) - l[-1])
	print(abs(x - y))


test = int(input())
while test > 0:
	n = int(input())
	lst = list()
	power = 1
	while power <= n:
		value = pow(2, power)
		lst.append(value)
		power += 1
	if len(lst) == 2:
		print(lst[1] - lst[0])
	else:
		i = len(lst) - 2
		sum1 = list()
		while i >= len(lst) / 2 - 1:
			sum1.append(lst[i])
			i = i - 1
		sum2 = list()
		sum2.append(lst[len(lst) - 1])
		i = 0
		while i < len(lst) / 2 - 1:
			sum2.append(lst[i])
			i += 1
		print(sum(sum2) - sum(sum1))
	test = test - 1


t = int(input())
for _ in range(t):
	n = int(input())
	x = pow(2, n)
	y = 0
	times = n // 2
	n -= 1
	while times > 0:
		y += pow(2, n)
		times -= 1
		n -= 1
	while n > 0:
		x += pow(2, n)
		n -= 1
	print(abs(x - y))


input = __import__('sys').stdin.readline
for _ in range(int(input())):
	n = int(input())
	fir = 0
	sec = 0
	tmp = (n - 2) // 2
	for i in range(1, tmp + 1):
		fir += 2 ** i
		sec += 2 ** (i + tmp)
	fir += 2 ** n
	sec += 2 ** (n - 1)
	print(fir - sec)


for i in range(int(input())):
	n = int(input())
	sum1 = int(pow(2, n))
	for j in range(int(n / 2)):
		sum1 -= int(pow(2, int(n / 2) + j))
	for j in range(int(n / 2) - 1):
		sum1 += int(pow(2, j + 1))
	print(sum1)


t = int(input())
for i in range(t):
	u = [0] * 30
	n = int(input())
	for k in range(n):
		u[k] = pow(2, k + 1)
	s = sum(u)
	m = n // 2
	t = 0
	for j in range(m - 1):
		t += u[j]
	t += u[n - 1]
	print(abs(s - 2 * t))


import sys
import math as mt
input = sys.stdin.buffer.readline

def bin(n):
	l = [0] * 40
	ind = 39
	while n:
		l[ind] = n & 1
		n = n >> 1
		ind -= 1
	return l
t = int(input())
for _ in range(t):
	n = int(input())
	print(2 ** (n // 2 + 1) - 2)


t = int(input())
while t > 0:
	n = int(input())
	n = n // 2 + 1
	print(2 ** n - 2)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = [0 for i in range(n)]
	for i in range(1, n + 1):
		a[i - 1] = 2 ** i
	sum_l = a[-1]
	count = 1
	i = 0
	while count != n // 2:
		sum_l += a[i]
		count += 1
		i += 1
	sum_r = 0
	for j in range(i, n - 1):
		sum_r += a[j]
	print(abs(sum_l - sum_r))


testcases = int(input())
for i in range(testcases):
	n = int(input())
	p = []
	r = []
	l = []
	for i in range(1, n + 1):
		p.append(2 ** i)
	r.append(p[-1])
	p.pop(-1)
	for i in range(n // 2 - 1):
		r.append(p[0])
		p.pop(0)
	print(sum(r) - sum(p))


for i in range(int(input())):
	print(2 ** (int(input()) // 2 + 1) - 2)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	arr = []
	for i in range(1, n + 1):
		arr.append(2 ** i)
	dp1 = arr[0:n // 2 - 1]
	dp1.append(arr[-1])
	dp2 = arr[n // 2 - 1:n - 1]
	print(abs(sum(dp1) - sum(dp2)))


t = int(input())
for i in range(t):
	b = int(input())
	c = int(2 * (2 ** (b / 2) - 1))
	print(c)


for q in range(int(input())):
	n = int(input())
	res = 2 ** n
	for i in range(1, n // 2):
		res += 2 ** i
	ans = 0
	for i in range(n // 2, n):
		ans += 2 ** i
	print(res - ans)


from itertools import combinations

def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))

def solve():
	n = read_int()
	nums = []
	for i in range(1, n + 1):
		nums.append(2 ** i)
	a = nums[-1]
	half = n // 2
	for i in range(half - 1):
		a += nums[i]
	total = sum(nums)
	print(abs(total - a - a))
t = read_int()
for case_num in range(t):
	solve()


t = int(input())
for _ in range(t):
	(n,) = map(int, input().split())
	(a, b) = (0, 0)
	for i in range(1, n // 2):
		a += 1 << i
	a += 1 << n
	for i in range(n // 2, n):
		b += 1 << i
	print(a - b)


for _ in range(int(input())):
	n = int(input())
	sum1 = 2 ** n
	sum2 = 0
	for i in range(n // 2 - 1):
		sum1 += 2 ** (i + 1)
	for i in range(n // 2 - 1, n - 1):
		sum2 += 2 ** (i + 1)
	print(abs(sum1 - sum2))


p = [0] + [2 ** i for i in range(1, 31)]
for t in range(int(input())):
	n = int(input())
	h = n // 2
	print(p[n] + sum(p[:h]) - sum(p[h:n]))


for u in range(int(input())):
	n = int(input())
	s = 0
	if n == 2:
		print(2)
	else:
		for i in range(1, n // 2):
			s = s + 2 ** i
		s = s + 2 ** n
		c = 0
		for i in range(n // 2, n):
			c = c + 2 ** i
		print(abs(s - c))


t = int(input())
for case in range(t):
	n = int(input())
	List = [2 ** k for k in range(1, n + 1)]
	List_a = [2 ** n]
	List_b = []
	for i in range(-1 + n // 2):
		List_a.append(List[i])
	print(abs(2 * sum(List_a) - sum(List)))


from collections import deque
n_max = 30
w = [2] * n_max
for i in range(1, n_max):
	w[i] = w[i - 1] * 2
t = int(input())
for _ in range(t):
	n = int(input())
	q = deque(w[:n])
	a = q.pop()
	b = q.pop()
	while q:
		a += q.popleft()
		b += q.pop()
	print(a - b)


for test in range(int(input())):
	n = int(input())
	s = 0
	for i in range(1, n + 1):
		if n // 2 <= i <= n - 1:
			s -= 2 ** i
		else:
			s += 2 ** i
	print(s)


def ans(n):
	return int(2 ** (n / 2 + 1) - 2)
t = int(input())
a = []
for i in range(t):
	n = int(input())
	a.append(n)
for i in range(t):
	print(ans(a[i]))


from math import fabs
T = int(input())
answer = ''
for t in range(T):
	n = int(input())
	arr = [2 ** i for i in range(1, n + 1)]
	a = b = 0
	a = arr[-1]
	for i in range(n // 2 - 1):
		a += arr[i]
	for i in range(n // 2 - 1, n - 1):
		b += arr[i]
	answer += str(int(fabs(a - b))) + '\n'
print(answer)


for i in range(int(input())):
	(a, b) = (0, 0)
	n = int(input())
	for j in range(1, n // 2):
		a += 2 ** j
	for j in range(n // 2, n):
		b += 2 ** j
	a += 2 ** n
	print(a - b)


t = int(input())
for case in range(t):
	n = int(input())
	dp = [0] * n
	a = 0
	for i in range(n):
		dp[i] = 2 ** (i + 1)
		a += dp[i]
	b = sum(dp[n - 1 - n // 2:n - 1])
	print(abs(a - 2 * b))


for q in range(int(input())):
	n = int(input())
	s = []
	s1 = []
	for i in range(1, n + 1):
		s.append(2 ** i)
	s1.append(s[n - 1])
	s.pop(n - 1)
	for i in range(n // 2 - 1):
		s1.append(s[0])
		s.pop(0)
	print(abs(sum(s) - sum(s1)))


import math

def get_num():
	return list(map(int, input().rstrip().split()))

def rotate(my_list, num):
	return my_list[num:] + my_list[:num]

def main():
	mynum = int(input())
	for i in range(mynum):
		num = int(input())
		pos = 2 ** num
		for i in range(1, int(num / 2)):
			pos += 2 ** i
		neg = 0
		for i in range(int(num / 2), num):
			neg += 2 ** i
		print(pos - neg)
main()


t = int(input())
result = []
for i in range(t):
	n = int(input())
	numbers = [2 ** i for i in range(1, n + 1)]
	a = numbers[-1] + sum(numbers[:n // 2 - 1])
	b = sum(numbers[n // 2 - 1:n - 1])
	res = abs(a - b)
	result.append(str(res))
print('\n'.join(result))


def binpow(n, k):
	if k <= 1:
		return n ** k
	if k % 2 == 0:
		a = binpow(n, k // 2)
		return a * a
	a = binpow(n, k - 1)
	return n * a

def log2(n):
	i = 0
	n -= 1
	while n > 1:
		n //= 2
		i += 1
	return i

def qw(n):
	if n == 1:
		return 0
	if n == 2:
		return 1
	m = log2(n)
	q = binpow(2, m)
	return qw(n - q) + 1 & 3
a = []

def ect(x, t):
	if t <= 0:
		return
	if x == 0:
		print(*a)
		return
	ect(x, t - 1)
	if x >= t:
		a.append(t)
		ect(x - t, t)
		a.pop(-1)

def ras(n):
	i = 1
	ans = 0
	while i * i <= n:
		if n % i == 0:
			ans += 2
		if i * i == n:
			ans -= 1
		i += 1
	return ans

def is_prime(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
t = int(input())
for i in range(t):
	n = int(input())
	print(2 ** (n // 2 + 1) - 2)


import sys
input = sys.stdin.readline
MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input().strip('\n'))
si = lambda : input().strip('\n')
dgl = lambda : list(map(int, input().strip('\n')))
f = lambda : map(int, input().strip('\n').split())
il = lambda : list(map(int, input().strip('\n').split()))
ls = lambda : list(input().strip('\n'))
lsi = lambda : [int(i) for i in ls()]
let = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(ii()):
	n = ii()
	sm = 0
	for i in range(1, n):
		if i < n // 2:
			sm += 2 ** i
		else:
			sm -= 2 ** i
	print(sm + 2 ** n)


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	s = sum(l)
	if n == 2:
		a = l[0]
		b = l[1]
	else:
		a = sum(l[0:n // 2 - 1]) + l[-1]
		b = s - a
	print(abs(a - b))


for i in range(int(input())):
	n = int(input())
	c = 2 ** n
	for j in range(n - 1, n // 2 - 1, -1):
		c -= 2 ** j
	for j in range(1, n // 2):
		c += 2 ** j
	print(c)


def split(n):
	numbers = []
	for i in range(1, n + 1):
		numbers.append(2 ** i)
	if len(numbers) == 2:
		print(numbers[-1] - numbers[0])
		return
	req = n // 2
	ans = numbers[-1]
	numbers.pop(-1)
	req -= 1
	i = 0
	while req > 0:
		ans += numbers[0]
		numbers.pop(0)
		req -= 1
	print(abs(ans - sum(numbers)))

def main():
	t = int(input())
	for i in range(t):
		split(int(input()))
main()


t = int(input())
for _ in range(t):
	n = int(input())
	x = 2 ** n
	y = 0
	for i in range(1, n):
		if i < n // 2:
			x += 2 ** i
		else:
			y += 2 ** i
	print(x - y)


for _ in range(int(input())):
	n = int(input())
	a = []
	for i in range(1, n + 1):
		a.append(2 ** i)
	k = a[-1] + sum(a[:n // 2 - 1])
	j = sum(a) - k
	print(k - j)


def main():
	for _ in range(int(input())):
		t = int(input())
		x = [2 ** t]
		y = [2 ** (t - 1)]
		for i in range(t // 2 - 1):
			x.append(2 ** (i + 1))
			y.append(2 ** (t // 2 - 1 + (i + 1)))
		print(sum(x) - sum(y))
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = 1 << n
	b = (1 << (n >> 1)) - 2
	c = (1 << n + 1) - 2 - a - b
	print(a + b - c)


class MyIO:

	def __init__(self):
		super().__init__()

	def read(self, cast=int):
		return cast(input().strip())

	def reads(self, sep=' ', cast=int):
		arr = []
		line = input().strip()
		if sep:
			line = line.strip().split(sep)
		filter(lambda l: not l, line)
		n = len(line)
		return [cast(line[i]) for i in range(n)]

	def readmatrix(self, rows, sep='', cast=int):
		arr = []
		for row in range(rows):
			arr.append(self.reads(sep=sep, cast=cast))
		return arr

	def printmatrix(self, matrix, sep=' '):
		output = []
		for sub in matrix:
			sub = map(str, sub)
			output.append(sep.join(sub))
		print('\n'.join(output))

class Solution:
	io = MyIO()

	def solve(self, n):
		pile = [0, 0]
		pile[0] = 2 ** n
		mid = n // 2
		for i in range(1, mid):
			pile[0] += 2 ** i
		for i in range(mid, n):
			pile[1] += 2 ** i
		return abs(pile[0] - pile[1])

	def start(self):
		t = self.io.read()
		for i in range(t):
			print(self.solve(self.io.read()))
Solution().start()


n = int(input())
for i in range(n):
	answer = 0
	t = int(input())
	a = t // 2
	for k in range(1, a + 1):
		answer += 2 ** k
	print(answer)


def do(n):
	print(int(2 * (2 ** (n / 2) - 1)))
t = int(input())
for _ in range(t):
	do(int(input()))


for tt in range(int(input())):
	(x, s) = (int(input()), 0)
	for i in range(1, x // 2):
		s += 2 ** i
	s2 = 2 ** x - s - 2
	s += 2 ** x
	print(s - s2)


for i in range(int(input())):
	n = int(input())
	a = 1
	t = 2 ** n
	y = 0
	if n == 2:
		print('2')
	else:
		for a in range(0, int(n / 2) - 1):
			a += 1
			t += 2 ** a
		for b in range(a, n - 1):
			b += 1
			y += 2 ** b
		print(abs(t - y))


a = int(input())
for _ in range(a):
	res1 = 0
	res2 = 0
	z = int(input())
	if z == 2:
		print('2')
	else:
		res1 = 2 ** z
		for i in range(int(z / 2) - 1):
			res1 += 2 ** (i + 1)
		for i in range(int(z / 2) - 1, z - 1, 1):
			res2 += 2 ** (i + 1)
		print(abs(res1 - res2))


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
for _testcases_ in range(int(input())):
	n = int(input())
	li = [2 ** i for i in range(1, n + 1)]
	mins = sum(li[:n // 2 - 1]) + li[-1]
	maxs = sum(li[n // 2 - 1:-1])
	print(abs(mins - maxs))


import sys
import math
pow_of_2 = [0] * 30
pow_of_2[0] = 2
for i in range(1, 30):
	pow_of_2[i] = pow_of_2[i - 1] * 2
test = int(sys.stdin.readline())
for i in range(test):
	n = int(sys.stdin.readline())
	if n == 2:
		print(2)
	else:
		total1 = 0
		for i in range(n):
			total1 += pow_of_2[i]
		total2 = 0
		for i in range(0, n // 2 - 1):
			total2 += pow_of_2[i]
		total2 += pow_of_2[n - 1]
		total1 -= total2
		print(abs(total1 - total2))


t = int(input())
while t != 0:
	n = int(input())
	a = []
	d = n // 2 - 1
	tm = n
	p = 2
	while tm != 0:
		a.append(p)
		p += p
		tm = tm - 1
	ff = 0
	for i in range(0, d):
		ff += a[i]
	ff += a[n - 1]
	ss = 0
	for i in range(0, n):
		ss += a[i]
	ss -= ff
	print(abs(ff - ss))
	t = t - 1


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
t = int(input())
li = []
for i in range(0, 31):
	li.append(2 ** i)
while t > 0:
	t -= 1
	n = int(input())
	c = n // 2
	sum1 = li[n] + sum(li[1:c])
	sum2 = sum(li[c:n])
	print(abs(sum1 - sum2))


def solve(a):
	n = int(a / 2) + 1
	ans = 2 ** n - 2
	return ans
no = int(input())
for i in range(no):
	a = int(input())
	print(solve(a))


t = int(input())
for i in range(t):
	n = int(input())
	half = int(n / 2)
	lst = [2 ** i for i in range(1, half)]
	result = 2 ** (n - 1) - sum(lst) * (2 ** len(lst) - 1)
	print(result)


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
for case in range(itg()):
	n = itg()
	a = 1 << n
	for i in range(n // 2 - 1):
		a += 2 << i
	b = 0
	for i in range(n // 2, n):
		b += 1 << i
	print(a - b)


import math as m
t = int(input())
for _ in range(t):
	n = int(input())
	a = 0
	b = 0
	for i in range(1, n // 2):
		a += m.pow(2, i)
	for i in range(n // 2, n):
		b += m.pow(2, i)
	a += m.pow(2, n)
	print(int(abs(a - b)))


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	print((1 << n // 2 + 1) - 2)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	num = [2] + [2 ** x for x in range(2, n + 1)]
	a = 0
	b = 0
	a += num[-1]
	for i in range(n // 2 - 1):
		a += num[i]
	for i in range(n // 2 - 1, n - 1):
		b += num[i]
	print(abs(a - b))


def power(n):
	o = 1
	for j in range(1, n + 1):
		o = o * 2
	return o
n = int(input())
for i in range(n):
	s = int(input())
	s = s // 2
	sum = 0
	for k in range(1, s + 1):
		sum = sum + power(k)
	print(sum)


t = int(input())
for s in range(t):
	n = int(input())
	i = 1
	k = []
	a = 0
	while i < n + 1:
		a = 2 ** i
		k.append(a)
		i += 1
		j = 0
		r = 0
		t = 0
	while j < len(k) - 1:
		if j < n // 2 - 1:
			r += k[j]
		elif j >= n // 2 - 1:
			t += k[j]
		j += 1
	z = k.pop()
	print(r + z - t)


import os
import sys
from io import BytesIO, IOBase
import threading

def main():
	for _ in range(int(input())):
		n = int(input())
		a = 2 ** n
		b = 0
		for i in range(1, n):
			if i < n // 2:
				a += 2 ** i
			else:
				b += 2 ** i
		print(abs(a - b))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input().strip(' '))):
	n = int(input().strip(' '))
	nums = [2 ** (i + 1) for i in range(n)]
	(a, b) = (nums[0:n // 2], nums[n // 2:n])
	l1 = a.pop()
	l2 = b.pop()
	a.append(l2)
	b.append(l1)
	diff = abs(sum(a) - sum(b))
	print(diff)


import sys
import bisect
from collections import Counter, defaultdict as dd

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def l():
	return list(sp())

def strl():
	return list(strsp())

def sp():
	return map(int, data().split())

def strsp():
	return map(str, data().split())
for _ in range(int(data())):
	n = int(data())
	a = []
	for i in range(1, n + 1):
		a.append(2 ** i)
	c = a[n - 1]
	for i in range(n // 2 - 1):
		c += a[i]
	d = sum(a) - c
	print(abs(d - c))


t = eval(input())
while t is not 0:
	n = eval(input())
	l = list(map(lambda x: 2 ** x, range(1, n + 1)))
	r = n // 2
	s = l[n - 1]
	s1 = 0
	for i in range(r - 1):
		s = s + l[i]
	for i in range(r - 1, n - 1):
		s1 += l[i]
	print(s - s1) if s >= s1 else print(s1 - s)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	s1 = sum(l[:n // 2 - 1]) + l[n - 1]
	s2 = sum(l[n // 2 - 1:-1])
	print(abs(s1 - s2))


t = int(input())
for _ in range(t):
	n = int(input())
	ans = 2 ** n
	i = 1
	while i < n // 2:
		ans += 2 ** i
		i += 1
	while i < n:
		ans -= 2 ** i
		i += 1
	print(abs(ans))


t = int(input())
for i in range(t):
	n = int(input())
	sum1 = 0
	l1 = []
	for i in range(1, n + 1):
		l1.insert(i - 1, 2 ** i)
		sum1 = sum1 + 2 ** i
	sum2 = l1[len(l1) - 1]
	for i in range(int(n / 2) - 1):
		sum2 = sum2 + l1[i]
	print(sum2 - (sum1 - sum2))


k = int(input())
for e in range(k):
	o = 0
	t = 0
	n = int(input())
	for i in range(1, int(n / 2)):
		o = o + 2 ** i
	o = o + 2 ** n
	for i in range(int(n / 2), n):
		t = t + 2 ** i
	print(o - t)


try:
	k = int(input())
	for i in range(k):
		z = int(input())
		sm1 = 0
		sm2 = 0
		for k in range(1, z + 1):
			if k < z / 2 or k == z:
				sm1 += 2 ** k
			else:
				sm2 += 2 ** k
		print(abs(sm2 - sm1))
except Exception:
	pass


t = int(input())
for _ in range(t):
	n = int(input())
	a = 0
	b = 0
	cnt = int(n / 2)
	l = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	fin = sum(l)
	a += l[-1]
	cnt -= 1
	for i in range(cnt):
		a += l[i]
	print(abs(a - (fin - a)))


def findBalance(n):
	count = 2
	i = 2
	j = 2
	while i != n:
		j *= 2
		count += j
		i += 2
	return count
t = int(input())
for i in range(t):
	k = findBalance(int(input()))
	print(k)


for _ in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	if n == 2:
		print(2)
		continue
	for j in range(1, n // 2):
		a += 2 ** j
	a += 2 ** n
	for j in range(n // 2, n):
		b += 2 ** j
	print(abs(a - b))


T = int(input())
for t in range(T):
	n = int(input())
	index = n / 2
	print(int(2 * (2 ** index - 1)))


T = int(input())

def solve():
	N = int(input())
	sm = 2 ** (N + 1) - 2
	gd = 2 ** N
	for i in range(1, N // 2):
		gd += 2 ** i
	print(abs(sm - 2 * gd))
for _ in range(T):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	l = [2 ** j for j in range(1, n + 1)]
	half = n // 2
	l1 = [l[j] for j in range(half - 1)]
	l1.append(l[n - 1])
	print(abs(sum(l) - 2 * sum(l1)))


test_case = int(input())
for i in range(test_case):
	num = int(input())
	list1 = []
	list2 = []
	if num == 2:
		print(num)
	else:
		list1.append(2 ** num)
		for item in range(1, num // 2):
			list1.append(2 ** item)
		for item2 in range(num // 2, num):
			list2.append(2 ** item2)
		print(sum(list1) - sum(list2))


for i in range(int(input())):
	n = int(input())
	ans = 2 ** (n // 2 + 1) - 2
	print(ans)


for _ in range(int(input())):
	n = int(input())
	result = 2 ** (n // 2) - 2 + 2 ** n - (2 ** n - 2 - (2 ** (n // 2) - 2))
	print(result)


t = int(input())
for _ in range(t):
	s = 0
	n = int(input())
	h = n // 2
	for i in range(1, n + 1):
		if i < h:
			s = s + 2 ** i
	s = s + 2 ** n
	s = 2 ** (n + 1) - 2 - s
	print(s // 2 ** (h - 1))


from itertools import permutations
t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for j in range(1, n + 1):
		l.append(2 ** j)
	u = sum(l[n - 1 - n // 2:n - 1])
	p = sum(l[0:n - 1 - n // 2]) + l[-1]
	print(abs(u - p))


t = int(input())
for i in range(t):
	x = int(input())
	sum1 = 2 ** x
	for i in range(1, x // 2):
		sum1 += 2 ** i
	sum2 = 0
	for i in range(x // 2, x):
		sum2 += 2 ** i
	print(sum1 - sum2)


t = int(input())
for i in range(t):
	n = int(input())
	a_total = 2 ** n
	b_total = 0
	for i in range(1, int(n / 2)):
		a_total += 2 ** i
	for j in range(int(n / 2), n):
		b_total += 2 ** j
	print(abs(a_total - b_total))


from functools import reduce
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(delimiter=' '):
		return input().split(delimiter)

	@staticmethod
	def list_int(delimiter=' '):
		return list(map(int, input().split(delimiter)))

def main():
	t = Read.int()
	for _ in range(t):
		n = Read.int()
		if n == 2:
			print(n)
		else:
			a = list((2 ** i for i in range(1, n + 1)))
			print(sum(a[0:n // 2 - 1]) + a[-1] - sum(a[n // 2 - 1:n - 1]))
main()


for _ in range(int(input())):
	n = int(input())
	s1 = 2 ** n
	s2 = 2 ** (n // 2)
	for i in range(1, n // 2):
		s1 = s1 + 2 ** i
	for j in range(n // 2 + 1, n):
		s2 = s2 + 2 ** j
	print(s1 - s2)


import sys
from collections import deque
input = sys.stdin.buffer.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

def slv(N):
	c = deque([2 ** i for i in range(1, N + 1)])
	p = [0, 0]
	p[0] += c.pop()
	p[1] += c.pop()
	for i in range(N // 2 - 1):
		p[0] += c.popleft()
		p[1] += c.pop()
	return abs(p[0] - p[1])

def main():
	T = read_int()
	for _ in range(T):
		N = read_int()
		print(slv(N))
main()


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = 2 ** n
		b = 2 ** (n - 1)
		for i in range((n - 2) // 2):
			if a < b:
				a += 2 ** (n - i - 2)
				b += 2 ** (i + 1)
			else:
				b += 2 ** (n - i - 2)
				a += 2 ** (i + 1)
		print(abs(a - b))
main()


for t in range(int(input())):
	n = int(input())
	r = []
	for i in range(n):
		r.append(2 ** (i + 1))
	f = 0
	g = 0
	for i in range(n):
		if i < n // 2 - 1:
			f = f + r[i]
		elif i == n - 1:
			f = f + r[i]
		else:
			g = g + r[i]
	print(abs(f - g))


t = int(input())
for j in range(t):
	n = int(input())
	l = [2 ** n]
	g = []
	for i in range(n - 1):
		if sum(g) < sum(l) and len(g) < n // 2:
			g.append(2 ** (n - i - 1))
		else:
			l.append(2 ** (n - i - 1))
	print(abs(sum(l) - sum(g)))


for testcase in range(int(input())):
	n = int(input())
	ans = 2 ** n + sum((2 ** i for i in range(1, n // 2)))
	ans -= sum((2 ** i for i in range(n // 2, n)))
	print(abs(ans))


ts = int(input())
for _ in range(ts):
	n = int(input())
	nhalf = n // 2
	sm_first = 2 ** n + 2 * (2 ** (nhalf - 1) - 1)
	sm_second = 2 ** nhalf * (2 ** nhalf - 1)
	print(abs(sm_first - sm_second))


import math
t = int(input())
for x in range(t):
	n = int(input())
	a = []
	for y in range(1, n + 1):
		a.append(int(math.pow(2, y)))
	h = a[-1]
	l = 0
	a.pop()
	for z in range(0, int(n / 2) - 1):
		h += a[z]
		a[z] = 0
	for i in a:
		l += i
	print(h - l)


T = int(input())
for t in range(T):
	n = int(input())
	a = 2 ** n + 2 ** (n / 2) - 2
	b = 2 ** (n + 1) - 2 - a
	print(int(a - b))


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		a = n / 2 + 1
		print(int(2 ** a - 2))


for t in range(int(input())):
	n = int(input())
	sum1 = 0
	sum2 = 0
	for i in range(n - 1, n - int(n / 2) - 1, -1):
		sum1 = sum1 + pow(2, i)
	for i in range(1, int(n / 2)):
		sum2 = sum2 + pow(2, i)
	sum2 = sum2 + pow(2, n)
	print(abs(sum1 - sum2))


import math
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = 0
	b = 0
	z = int(n / 2)
	for i in range(1, n):
		if i < z:
			a = a + 2 ** i
		else:
			b = b + 2 ** i
	a = a + 2 ** n
	print(a - b)


for i in range(int(input())):
	n = int(input())
	l = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	c = sum(l[:n // 2])
	print(c)


for _ in range(int(input())):
	n = int(input())
	temp = 0
	temp2 = 0
	if n == 2:
		print('2')
	else:
		for i in range(1, n):
			if i < n // 2:
				temp += 2 ** i
			else:
				temp2 += 2 ** i
		ans = 2 ** n + temp - temp2
		print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2:
		print(2)
	else:
		a = [2 ** i for i in range(1, n + 1)]
		x = a[-1]
		a[-1] = 0
		f = 1
		for i in range(n // 2 - 1):
			x += a[i]
			a[i] = 0
		print(abs(sum(a) - x))


t = int(input())
for _ in range(t):
	print(2 ** (int(int(input()) / 2) + 1) - 2)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	l = []
	for i in range(n):
		x = 2 ** (i + 1)
		l.append(x)
	li = []
	li.append(l[n - 1])
	for i in range(n // 2 - 1):
		li.append(l[i])
	l = list(set(l) ^ set(li))
	print(abs(sum(l) - sum(li)))


t = int(input())
for asjda in range(t):
	n = int(input())
	if n == 0:
		print(0)
	maxa = pow(2, n - 1)
	sub1 = pow(2, int(n / 2)) * (pow(2, int(n / 2) - 1) - 1)
	sub2 = 2 * (pow(2, int(n / 2) - 1) - 1)
	print(maxa - sub1 + sub2)


for _ in range(int(input())):
	n = int(input())
	c = 2 ** n
	for i in range(n - 1, int(n / 2) - 1, -1):
		c -= 2 ** i
	for i in range(int(n / 2) - 1, 0, -1):
		c += 2 ** i
	print(c)


testCase = int(input())
outputList = []
for i in range(0, testCase):
	coinNumber = int(input())
	weightSum = 0
	bossCoin = 2 ** coinNumber
	hostageNumber = int(coinNumber / 2) - 1
	bossGroup = bossCoin
	for k in range(1, coinNumber + 1):
		weightSum += 2 ** k
	for j in range(1, hostageNumber + 1):
		bossGroup += 2 ** j
	minorGroup = weightSum - bossGroup
	testOutput = bossGroup - minorGroup
	outputList.append(testOutput)
for o in outputList:
	print(o)


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print(2)
		continue
	c = 2 ** (n + 1) - 2
	a = 2 ** n + 2 ** (n // 2) - 2
	b = c - a
	print(abs(b - a))


t = int(input())
for i in range(t):
	x = int(input())
	s = 2 * (2 ** (x // 2) - 1)
	print(s)


tests = int(input())
for tests in range(tests):
	n = int(input())
	p = 0
	v = 0
	dob = 2
	for i in range(n // 2 - 1):
		p += dob
		dob *= 2
	for i in range(n // 2):
		v += dob
		dob *= 2
	p += dob
	print(abs(p - v))


import sys
input = sys.stdin.readline
from collections import *
t = int(input())
for _ in range(t):
	n = int(input())
	(a, b) = (0, 0)
	for i in range(1, n + 1):
		if i <= n // 2 - 1 or i == n:
			a += 2 ** i
		else:
			b += 2 ** i
	print(abs(a - b))


for t in range(int(input())):
	n = int(input())
	all_nums = []
	for i in range(1, n + 1):
		all_nums.append(2 ** i)
	print(all_nums[-1] + sum(all_nums[:n // 2 - 1]) - sum(all_nums[n // 2 - 1:-1]))


for _ in range(int(input())):
	n = int(input())
	sum1 = pow(2, n)
	sum2 = 0
	if n == 2:
		print(2)
	else:
		for i in range(n // 2 - 1):
			sum1 += pow(2, i + 1)
			t = i
		for j in range(i + 1, n - 1):
			sum2 += pow(2, j + 1)
		print(abs(sum1 - sum2))


import math
import sys
t = int(input())
for i in range(t):
	n = int(input())
	s1 = 0
	for i in range(1, n // 2):
		s1 += 2 ** i
	s1 += 2 ** n
	s2 = 2 ** (n + 1) - 2 - s1
	print(s1 - s2)


import sys
import math
tests = int(sys.stdin.readline().split()[0])
for test in range(tests):
	n = int(sys.stdin.readline().split()[0])
	coins = [2 ** x for x in range(1, n + 1, 1)]
	if n == 2:
		print(int(math.fabs(coins[0] - coins[1])))
		continue
	i = 0
	a = 2 ** n
	while i < n // 2 - 1:
		a += coins[i]
		i += 1
	b = 0
	i = n // 2 - 1
	while i < n - 1:
		b += coins[i]
		i += 1
	print(int(math.fabs(a - b)))


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print(2)
	else:
		mid = int((n - 1) / 2)
		list1 = []
		sum1 = 0
		sum2 = 0
		for i in range(30):
			list1.append(2 ** (i + 1))
		for i in range(mid):
			sum1 += list1[i]
		for i in range(mid, n - 1):
			sum2 += list1[i]
		sum1 += list1[n - 1]
		print(sum1 - sum2)


def function(n):
	(sum, sum2) = (0, 0)
	for i in range(n // 2 - 1):
		sum += pow(2, i + 1)
	sum += pow(2, n - 1 + 1)
	for i in range(n - 2, n - 2 - n // 2, -1):
		sum2 += pow(2, i + 1)
	return sum - sum2
t = int(input())
while t:
	n = int(input())
	print(function(n))
	t -= 1


def S(x):
	return 2 ** (x + 1) - 2
t = int(input())
for i in range(t):
	n = int(input())
	x1 = S(n // 2) - 2 ** (n // 2) + 2 ** n
	x2 = S(n) - S(n // 2) - 2 ** n + 2 ** (n // 2)
	print(abs(x1 - x2))


t = int(input())
while t > 0:
	t -= 1
	a = []
	n = int(input())
	for i in range(1, n + 1):
		a.append(2 ** i)
	p = a[:n // 2 - 1]
	q = a[n // 2 - 1:-1]
	p.append(a[-1])
	print(abs(sum(p) - sum(q)))


y = int(input())
for i in range(y):
	x = int(input())
	l = [2 ** i for i in range(1, x + 1)]
	if x == 2:
		print(2)
	else:
		f = x // 2 - 1
		c = sum(l[f:f + x // 2])
		d = sum(l) - c
		print(d - c)


test_cases = int(input())
for _ in range(test_cases):
	n = int(input())
	first = 2 ** n
	second = 2 ** (n - 1)
	n = n - 2
	temp = 2 ** (n // 2)
	first = first + 2 * (temp - 1)
	second = second + 2 * temp * (temp - 1)
	print(first - second)


t = int(input())
for i in range(t):
	n = int(input())
	o1 = 2 ** n
	o2 = 0
	for f in range(1, int(n / 2)):
		o1 += 2 ** f
	for g in range(int(n / 2), n):
		o2 += 2 ** g
	print(o1 - o2)


t = int(input())
while t > 0:
	n = int(input())
	sum1 = 2 ** n
	for i in range(1, n // 2):
		sum1 += 2 ** i
	sum2 = 0
	for i in range(n // 2, n):
		sum2 += 2 ** i
	print(sum1 - sum2)
	t -= 1


N = int(input())
for _ in range(N):
	l = []
	l1 = []
	l2 = []
	n = int(input())
	for i in range(1, n // 2):
		l.append(2 ** i)
	l.append(2 ** n)
	for j in range(n // 2, n):
		l1.append(2 ** j)
	print(sum(l) - sum(l1))


t = int(input())
i = 0
while i < t:
	n = int(input())
	print(2 + 2 * sum((2 ** i for i in range(1, n // 2))))
	i += 1


t = int(input())
for _ in range(t):
	n = int(input())
	pows = [2 ** i for i in range(1, n + 1)]
	print(pows[-1] + sum(pows[:n // 2 - 1]) - sum(pows[n // 2 - 1:-1]))


import math
lista = []
sum = 0
sum2 = 0
resultado = 0
for x in range(int(input())):
	y = int(input())
	for numeros in range(1, y + 1):
		lista.append(2 ** numeros)
	for num in range(math.floor((y - 1) / 2)):
		sum += lista[num]
	for num2 in range(y):
		sum2 += lista[num2]
	sum += lista[y - 1]
	dif = sum2 - sum
	resultado = sum - dif
	print(resultado)
	lista = []
	sum = 0
	sum2 = 0
	resultado = 0


t = int(input())
for case in range(t):
	n = int(input())
	main = [2 ** exp for exp in range(1, n + 1)]
	p1 = []
	p1.append(max(main))
	main.remove(max(main))
	for num in main[:n // 2 - 1]:
		p1.append(num)
		main.remove(num)
	p1_total = sum(p1)
	p2_total = sum(main)
	print(abs(p1_total - p2_total))


def read_int():
	n = int(input())
	return n

def read_ints():
	ints = [int(x) for x in input().split(' ')]
	return ints

def solve(n):
	p1 = []
	p2 = []
	for i in range(1, n + 1):
		if i == n:
			p1.append(pow(2, i))
		elif i < n // 2:
			p1.append(pow(2, i))
		else:
			p2.append(pow(2, i))
	return sum(p1) - sum(p2)
t = read_int()
for case in range(t):
	n = read_int()
	sol = solve(n)
	print(sol)


for i in range(int(input())):
	n = int(input())
	result = 0
	for j in range(0, n // 2 - 1):
		result += 2 ** (j + 1)
	for j in range(n // 2 - 1, n - 1):
		result -= 2 ** (j + 1)
	result += 2 ** n
	print(abs(result))


R = lambda : map(int, input().split())
for _ in range(int(input())):
	print(2 ** (int(input()) // 2 + 1) - 2)


t = int(input())
for a in range(t):
	n = int(input())
	weightA = 0
	for b in range(1, n // 2):
		weightA += pow(2, b)
	weightA += pow(2, n)
	weightB = pow(2, n + 1) - 2 - weightA
	print(abs(weightA - weightB))


def solve():
	t = int(input())
	add = len
	for i in range(t):
		n = int(input())
		if n <= 2:
			print(n)
			continue
		lst = [int(2 ** i) for i in range(1, n + 1)]
		pile1 = []
		pile2 = []
		pile1.append(lst.pop(len(lst) - 1))
		count1 = pile1[0]
		count2 = 0
		while add(lst) > 0:
			while add(lst) > 0 and count2 < count1 and (add(pile2) < n // 2):
				pile2.append(lst.pop(add(lst) - 1))
				count2 += pile2[-1]
			if add(pile2) == n // 2:
				while add(lst) > 0:
					pile1.append(lst.pop(add(lst) - 1))
					count1 += pile1[-1]
			else:
				pile1.append(lst.pop(add(lst) - 1))
				count1 += pile1[-1]
		print(abs(count2 - count1))
solve()


import sys
import math
from functools import reduce
import bisect

def getN():
	return int(input())

def getNM():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def input():
	return sys.stdin.readline().rstrip()

def index(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	return False
for _ in range(int(input())):
	n = getN()
	if n == 2:
		print(2)
		continue
	a = 2 ** n + sum([2 ** x for x in range(1, n // 2)])
	b = sum([2 ** x for x in range(n // 2, n)])
	print(abs(b - a))


test_case = int(input())
for i in range(test_case):
	n = int(input())
	count1 = 2 ** n
	count2 = 0
	for i in range(1, int(n / 2)):
		count1 += 2 ** i
	for z in range(int(n / 2), n):
		count2 = count2 + 2 ** z
	print(count1 - count2)


for _ in range(int(input())):
	n = int(input())
	a = 2 ** n + sum([2 ** i for i in range(1, n // 2)])
	b = sum([2 ** i for i in range(n // 2, n)])
	print(a - b)


try:
	t = int(input())
	for i in range(t):
		n = int(input())
		ans = 2
		if n == 2:
			print(ans)
		else:
			x = n // 2
			y = x + 1
			ans = 2 ** y - 2
			print(ans)
except EOFError:
	pass


for _ in range(int(input())):
	n = int(input())
	ans = 0
	while n > 0:
		ans += 1
		ans *= 2
		n -= 2
	print(ans)


import collections
from functools import lru_cache

def solve(n):
	totalSum = sum([2 ** i for i in range(1, n + 1)])
	currSum = 2 ** n
	for i in range(1, n // 2):
		currSum += 2 ** i
	secondSum = totalSum - currSum
	return abs(secondSum - currSum)
t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	print(solve(n))


n = int(input())
for i in range(int(n)):
	a = int(input())
	total = 2 ** (a + 1) - 2
	x = 2 ** a + 2 ** (a // 2) - 2
	y = total - x
	print(max(x - y, y - x))


t = int(input())
while t > 0:
	inp = int(input())
	if inp == 2:
		print('2')
	else:
		p1 = 0
		p2 = 0
		for i in range(1, int(inp / 2)):
			p1 += 2 ** i
		p1 += 2 ** inp
		for i in range(int(inp / 2)):
			p2 += 2 ** (i + int(inp / 2))
		print(p1 - p2)
	t -= 1


for i in range(int(input())):
	n = int(input())
	c = 2 ** n
	for j in range(n - 1, 0, -1):
		if j >= n // 2:
			c -= 2 ** j
		else:
			c += 2 ** j
	print(c)


def solve(x):
	sum_a = 0
	sum_b = 0
	output = 0
	for i in range(x):
		if i < x / 2 - 1 or i == x - 1:
			sum_a += pow(2, i + 1)
		else:
			sum_b += pow(2, i + 1)
	output = sum_a - sum_b
	return output
t = int(input())
for e in range(t):
	n = int(input())
	print(solve(n))


t = int(input())
for _ in range(t):
	n = int(input())
	k = n // 2 - 1
	s1 = 2 ** (k + 1) - 2 + 2 ** n
	total = 2 ** (n + 1) - 2
	s2 = total - s1
	diff = abs(s1 - s2)
	print(diff)


from sys import stdin
for i in range(int(input())):
	n = int(input())
	print(2 ** (n // 2 + 1) - 2)


cases = []
for i in range(int(input())):
	cases.append(int(input()))
for i in cases:
	weights = []
	for p in range(1, i + 1):
		weights.append(2 ** p)
	a = []
	b = []
	for j in range(len(weights)):
		if len(b) < int(len(weights) / 2) and len(weights) > 2:
			b.append(weights[-2 - j])
		elif len(weights) == 2:
			a.append(4)
			b.append(2)
			break
		else:
			a = [i for i in weights if i not in b]
	print(sum(a) - sum(b))


t = int(input())
for i in range(t):
	n = int(input())
	p = pow(2, n / 2 + 1)
	print(int(p) - 2)


t = int(input())
for i in range(t):
	n = int(input())
	a = [2 ** i for i in range(1, n + 1)]
	c = a[-1]
	for i in range(n // 2 - 1):
		c += a[i]
	d = sum(a) - c
	print(c - d)


t = int(input())
for x in range(t):
	n = int(input())
	s = 2 * (2 ** (n - 1) - 1) - 2 * (2 ** (n // 2 - 1) - 1)
	b = 2 * (2 ** (n // 2 - 1) - 1) + 2 ** n
	print(b - s)


for _ in range(int(input())):
	n = int(input())
	l = [0, 2]
	s = 2
	if n == 2:
		print(2)
	else:
		for j in range(2, n // 2):
			l.append(2 * l[j - 1])
			s += l[j]
		s += 2 ** n
		for j in range(n // 2, n):
			l.append(2 * l[j - 1])
			s -= l[j]
		print(s)


import sys, math
for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(2)
	else:
		mas = []
		for i in range(1, n + 1):
			mas.append(2 ** i)
		a = mas[-1]
		for i in range(n // 2 - 1):
			a += mas[i]
		print(abs(a - (sum(mas) - a)))


t = int(input())
for case in range(t):
	n = int(input())
	sm1 = 0
	sm2 = 1 << n
	for i in range(1, n // 2):
		sm2 += 1 << i
	for i in range(n // 2, n):
		sm1 += 1 << i
	print(abs(sm2 - sm1))


n = int(input())
for i in range(n):
	a = int(input())
	b = []
	for j in range(1, a + 1):
		b.append(1 << j)
	c1 = 0
	c2 = 0
	m = a // 2
	for i in range(m - 1):
		c1 += b[i]
	c1 += b[a - 1]
	for i in range(m - 1, a - 1):
		c2 += b[i]
	print(abs(c1 - c2))


times = int(input())
while times:
	times -= 1
	n = int(input())
	p1 = 0
	p2 = 0
	pows = [i for i in range(1, n + 1)]
	for i in range(0, n):
		if i % 2 == 0:
			if p1 <= p2:
				p1 += 2 ** max(pows)
				pows.remove(max(pows))
			else:
				p1 += 2 ** min(pows)
				pows.remove(min(pows))
		elif p2 <= p1:
			p2 += 2 ** max(pows)
			pows.remove(max(pows))
		else:
			p2 += 2 ** min(pows)
			pows.remove(min(pows))
	print(abs(p1 - p2))


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	s = 0
	a = 2 ** n
	for i in range(n // 2 - 1, n - 1):
		s = s + 2 ** (i + 1)
	for i in range(n // 2 - 1):
		a = a + 2 ** (i + 1)
	k = abs(a - s)
	print(k)


import math
t = int(input())
for i in range(t):
	n = int(input())
	ans = int(math.pow(2, n // 2 + 1) - 2)
	print(ans)


def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))

def solve():
	n = read_int()
	s1 = 2 ** n
	s2 = 0
	for i in range(1, n // 2):
		s1 += 2 ** i
	for i in range(n // 2, n):
		s2 += 2 ** i
	print(s1 - s2)
t = read_int()
for case_num in range(t):
	solve()


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	s = 2 ** (n // 2) - 2 + 2 ** n
	s -= 2 ** n - 2 ** (n // 2)
	ans.append(s)
for i in ans:
	print(i)


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	for _ in range(II()):
		n = II()
		n //= 2
		print((1 << n + 1) - 2)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [1 << i for i in range(1, n + 1)]
	arr.insert(0, arr.pop())
	print(sum(arr[:n // 2]) - sum(arr[n // 2:]))


t = int(input())
for i in range(t):
	n = int(input())
	p = 2 ** (n + 1) - 2
	q = n // 2 - 1
	s = 2 ** (q + 1) - 2 + 2 ** n
	p = p - s
	print(abs(p - s))


t = int(input())
for i in range(t):
	n = int(input())
	digits = []
	for j in range(1, n + 1):
		if j == 0:
			j = 1
		digits.append(2 ** j)
	s = sum(digits)
	mid = s / 2
	s1 = 0
	s2 = 0
	s1 = digits[-1] + sum(digits[:int(n / 2 - 1)])
	s2 = sum(digits[int(n / 2 - 1):n - 1])
	print(s1 - s2)


n = int(input())
tests = [int(input()) for _ in range(n)]
ans = []
for p in tests:
	a = sum([2 ** i for i in range(1, p // 2)] + [2 ** p])
	b = sum([2 ** i for i in range(p // 2, p)])
	ans.append(abs(a - b))
[print(_) for _ in ans]


for _ in range(int(input())):
	n = int(input())
	(total1, total2) = (0, 0)
	total1 += 2 ** n
	x = n // 2
	n -= 1
	for i in range(x):
		total2 += 2 ** n
		n -= 1
	while n > 0:
		total1 += 2 ** n
		n -= 1
	print(abs(total1 - total2))


t = int(input())
for i in range(0, t):
	n = int(input())
	arr = []
	for j in range(1, n + 1):
		arr.append(2 ** j)
	a = 0
	b = 0
	if n == 2:
		print(abs(arr[0] - arr[1]))
	else:
		for l in range(0, n - 1):
			if l < int(n / 2) - 1:
				a = a + arr[l]
			else:
				b = b + arr[l]
		a = a + arr[n - 1]
		print(abs(a - b))


for i in range(int(input())):
	a = int(input())
	c = []
	d = []
	for j in range(1, a + 1):
		c.append(pow(2, j))
	sum1 = 0
	sum2 = 0
	if len(c) == 2:
		print(c[1] - c[0])
	else:
		sum1 += c[-1]
		sum2 += c[-2]
		c.remove(c[-1])
		c.remove(c[-1])
		for k in range(int(len(c) / 2)):
			sum1 += c[k]
			sum2 += c[-1 - k]
		print(abs(sum1 - sum2))


for _ in range(int(input())):
	n = int(input())
	b = 2 ** n
	for i in range(1, n // 2):
		b += 2 ** i
	s = 2 ** (n + 1) - 2
	a = s - b
	print(abs(b - a))


for f in range(int(input())):
	n = int(input())
	n2 = n // 2
	x1 = 0
	x2 = 0
	x = 2
	for i in range(n2 - 1):
		x1 += x
		x *= 2
	for i in range(n2 - 1, n - 1):
		x2 += x
		x *= 2
	x1 += x
	print(x1 - x2)


for ii in range(int(input())):
	n = int(input())
	if n == 2:
		print(2)
		continue
	temp = 0
	temp += pow(2, n)
	for i in range(1, n // 2):
		temp += pow(2, i)
	for i in range(n // 2, n):
		temp -= pow(2, i)
	print(temp)


arr = []
for i in range(1, 31):
	arr.append(2 ** i)
for _ in range(int(input())):
	n = int(input())
	narr = arr[:n]
	if n == 2:
		print(2)
		continue
	temp = int(n / 2 - 1)
	first = narr[-1] + sum(narr[:temp])
	second = sum(narr[temp:n - 1])
	print(first - second)


def pbal(n):
	l = []
	for i in range(0, n):
		l.append(2 ** (i + 1))
	(g1, g2) = (0, 0)
	min = 999999
	s = n // 2
	for i in range(s):
		g1 = g1 + l[n - 2 - i]
	g2 += l[n - 1]
	for i in range(s - 1):
		g2 += l[i]
	return abs(g2 - g1)
x = int(input())
d = []
for i in range(x):
	n = int(input())
	d.append(pbal(n))
for i in d:
	print(i)


for _ in range(int(input())):
	n = int(input())
	A = []
	t = 0
	k = 0
	if n == 2:
		print(2)
	else:
		for i in range(1, n + 1):
			A.append(2 ** i)
		k += sum(A[:n // 2 - 1])
		k += A[-1]
		print(abs(sum(A) - 2 * k))


import sys, math, cmath, time
start_time = time.time()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def solve():
	n = inp()
	print(abs(2 ** (n + 1) - 2 - (2 ** n + 2 ** (n // 2) - 2) - (2 ** n + 2 ** (n // 2) - 2)))

def main():
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
	sys.stdout.close()

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


t = int(input())
while t:
	print(2 ** (int(input()) // 2 + 1) - 2)
	t -= 1


t = int(input())
while t > 0:
	sum_1 = 0
	sum_2 = 0
	n = int(input())
	sum_1 = 2 ** n
	div = int(n / 2)
	for i in range(1, div):
		sum_1 += 2 ** i
	for i in range(div, n):
		sum_2 += 2 ** i
	print(abs(sum_1 - sum_2))
	t -= 1


t = int(input())
n = []
for i in range(t):
	n.append(int(input()))
for i in range(t):
	w1 = 2 ** n[i]
	w2 = 0
	for j in range(1, n[i] // 2):
		w1 += 2 ** j
	for j in range(n[i] // 2, n[i]):
		w2 += 2 ** j
	print(abs(w1 - w2))


for _ in [0] * int(input()):
	n = int(input())
	print(2 * (1 << (n >> 1)) - 2)


class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi
for _ in range(int(input())):
	n = int(input())
	a = []
	for i in range(1, n + 1):
		a += [2 ** i]
	ans0 = a[-1]
	for i in range(n // 2 - 1):
		ans0 += a[i]
	ans1 = sum(a) - ans0
	print(abs(ans0 - ans1))


for _ in range(int(input())):
	n = int(input())
	ans = 2
	add = 2
	for i in range(1, n // 2):
		add = add * 2
		ans = ans + add
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2:
		print(2)
		continue
	ans = 2 ** 31
	for left in range(1, n - 2 + 1):
		for middle in range(left + 1, n):
			if left + n - middle != middle - left:
				continue
			outer = 0
			inner = 0
			for i in range(1, left + 1):
				outer += 2 ** i
			for i in range(left + 1, middle + 1):
				inner += 2 ** i
			for i in range(middle + 1, n + 1):
				outer += 2 ** i
			if ans > abs(outer - inner):
				ans = abs(outer - inner)
	print(ans)


t = int(input())
result = []
for i in range(t):
	arr = []
	n = int(input())
	mid = n // 2
	for i in range(1, n + 1):
		arr.append(2 ** i)
	a = arr[-1] + sum(arr[:mid - 1])
	b = sum(arr[mid - 1:-1])
	if n == 2:
		result.append(2)
	else:
		result.append(abs(b - a))
for i in result:
	print(i)


from sys import stdin, stdout
import math
import bisect
from collections import defaultdict
import datetime
import random
from queue import PriorityQueue
tc = int(stdin.readline().strip())
for i in range(tc):
	n = int(stdin.readline().strip())
	ttl1 = 0
	ttl2 = 0
	for j in range(1, n // 2):
		ttl1 += 2 ** j
	ttl1 += 2 ** n
	for j in range(n // 2, n):
		ttl2 += 2 ** j
	stdout.writelines(str(ttl1 - ttl2) + '\n')


def solve_wrong(n):
	a = []
	b = []
	nums = [2 ** i for i in range(1, n + 1)]
	for num in reversed(nums):
		if a < b:
			a.append(num)
		else:
			b.append(num)
	a.sort()
	b.sort()
	if len(b) > len(a):
		(a, b) = (b, a)
	idx = len(a) - len(b) - 1
	f_a = a[idx:]
	f_b = b + a[:idx]
	return abs(sum(f_a) - sum(f_b))

def solve_wrong_2(n):
	a = []
	b = []
	nums = [2 ** i for i in range(1, n + 1)]
	for i in range(n // 2):
		if i % 2 == 0:
			a.append(nums[i])
			a.append(nums[n - i - 1])
		else:
			b.append(nums[i])
			b.append(nums[n - i - 1])
	return abs(sum(a) - sum(b))

def solve(n):
	return 2 ** (n // 2 + 1) - 2

def main():
	T = int(input())
	for _ in range(T):
		n = int(input())
		print(solve(n))
main()


def pb(n):
	cnt = 0
	sum = [0, 0]
	if n == 2:
		return 2
	l = list(range(1, n))
	sum[1] += 2 ** n
	tr = 0
	tr2 = 1
	while len(l) > 0:
		mini = 1000000000.0 + 3
		idx = 0
		for i in l:
			dif = abs(sum[tr2] - (sum[tr] + 2 ** i))
			if dif < mini:
				idx = i
				mini = dif
		sum[tr] += 2 ** idx
		l.remove(idx)
		tmp = tr
		tr = tr2
		tr2 = tmp
	return abs(sum[1] - sum[0])
t = int(input())
test_cases = []
for tc in range(1, min(t + 1, 101)):
	test_cases.append(int(input()))
for tc in test_cases:
	print(pb(tc))


for _ in range(int(input())):
	n = int(input())
	L = [2] * n
	for i in range(1, n + 1):
		L[i - 1] = L[i - 1] ** i
	a = L[-1]
	b = 0
	a += sum(L[:int(n / 2) - 1])
	b = sum(L[int(n / 2) - 1:n - 1])
	print(abs(a - b))


for _ in range(int(input())):
	n = int(input())
	x = pow(2, n)
	for i in range(1, n // 2):
		x += pow(2, i)
	y = 0
	for i in range(n // 2, n):
		y += pow(2, i)
	print(x - y)


t = int(input())
for _ in range(t):
	n = int(input())
	i = 2
	for j in range(2, n // 2 + 1):
		i += 2 ** j
	print(i)


tc = int(input())
for i in range(tc):
	n = int(input())
	(suma, sumb, cnta, cntb) = (0, 1, 0, 0)
	x = [i for i in range(1, n + 1)]
	while cnta < n // 2 and cntb < n // 2:
		if suma < sumb:
			suma += 2 ** x[-1]
			x.pop(-1)
			cnta += 1
		else:
			suma += 2 ** x[0]
			x.pop(0)
			cnta += 1
		if sumb < suma:
			sumb += 2 ** x[-1]
			x.pop(-1)
			cntb += 1
		else:
			sumb += 2 ** x[0]
			x.pop(0)
			cntb += 1
	print(abs(suma - sumb + 1))


num = int(input())
arr = [[] * num for i in range(num)]
for i in range(0, num):
	a = int(input())
	for j in range(a):
		arr[i].append(pow(2, j + 1))
for i in range(0, len(arr)):
	sum1 = arr[i][len(arr[i]) - 1]
	sum2 = 0
	for j in range(0, int(len(arr[i]) / 2) - 1):
		sum1 = sum1 + arr[i][j]
	for j in range(int(len(arr[i]) / 2) - 1, int(len(arr[i])) - 1):
		sum2 = sum2 + arr[i][j]
	print(abs(sum1 - sum2))


t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	j = -1
	s = 0
	s1 = 0
	for i in range(n // 2):
		s += l[j]
		j += 1
	for i in range(n // 2):
		s1 += l[j]
		j += 1
	print(abs(s - s1))


def main():
	ans = []
	for i in range(int(input())):
		ans.append(2 ** (int(input()) // 2 + 1) - 2)
	print('\n'.join([str(i) for i in ans]))
main()


from collections import defaultdict as dd
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	l = [1] * (n + 1)
	if n == 2:
		print('2')
	elif n == 4:
		print('6')
	else:
		for i in range(1, n + 1):
			l[i] = l[i - 1] * 2
		x = l[1:n // 2]
		y = l[n // 2:n]
		print(abs(l[-1] + sum(x) - sum(y)))


n = int(input())
for iq in range(n):
	arr = []
	q = int(input())
	for i in range(1, q + 1):
		arr.append(2 ** i)
	sumi1 = arr[0] + arr[len(arr) - 1]
	sumi2 = 0
	if q == 2:
		print(2)
	elif q == 4:
		print(6)
	else:
		cnt = 2
		forget = 0
		for i in range(1, 100000):
			if cnt == q // 2:
				forget = i
				break
			else:
				cnt += 1
				sumi1 += arr[i]
		for i in range(forget, 10000000):
			if cnt == q:
				break
			cnt += 1
			sumi2 += arr[i]
		print(abs(sumi1 - sumi2))


for _ in range(int(input())):
	n = int(input())
	x = n // 2
	l = []
	a = []
	b = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	for i in range(x - 1):
		a.append(l[i])
	a.append(l[n - 1])
	for i in range(x - 1, n - 1):
		b.append(l[i])
	asu = sum(a)
	bsu = sum(b)
	print(abs(asu - bsu))


for _ in range(int(input())):
	n = int(input())
	a = []
	b = []
	i = 0
	c = []
	d = []
	for i in range(1, int(n / 2)):
		a.append(2 ** i)
		b.append(2 ** (int(n / 2) - 1 + i))
	sa = sum(a) + 2 ** n
	sb = sum(b) + 2 ** (n - 1)
	print(sa - sb)


def min_diff(n):
	if n == 2:
		return 2
	ans = pow(2, n // 2 + 1) - 2
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	ans = min_diff(n)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	sm = 0
	for j in range(1, int(n / 2)):
		sm += 2 ** j
	fm = 2 ** n - sm - 2
	sm += 2 ** n
	print(sm - fm)


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	m = n // 2
	diff = pow(2, n)
	diff -= pow(2, n) - 2
	if m > 0:
		diff += 2 * (pow(2, m) - 2)
	print(diff)


t = int(input())
for q in range(t):
	n = int(input())
	L = [2]
	for i in range(n - 1):
		L.append(L[-1] * 2)
	s1 = L[-1]
	s2 = 0
	for i in range(n // 2 - 1):
		s1 += L[i]
	for i in range(n // 2 - 1, n - 1):
		s2 += L[i]
	print(abs(s1 - s2))


t = int(input())
while t:
	n = int(input())
	max = n // 2
	li = []
	for i in range(n, 0, -1):
		li.append(2 ** i)
	l = []
	r = []
	l.append(li[0])
	r.append(li[1])
	for i in range(2, n):
		if sum(r) < sum(l):
			if len(r) < max:
				r.append(li[i])
			else:
				l.append(li[i])
		elif len(l) < max:
			l.append(li[i])
		else:
			r.append(li[i])
	print(abs(sum(l) - sum(r)))
	t -= 1


t = int(input())
for x in range(0, t):
	n = int(input())
	l = [2 ** x for x in range(1, n + 1)]
	a = l.pop(n - 1)
	b = l.pop(n - 2)
	for x in range(len(l) // 2, n - 2):
		b = b + l[x]
	for x in range(0, len(l) // 2):
		a = a + l[x]
	print(abs(a - b))


t = int(input())
for i in range(t):
	n = int(input())
	a = 2 ** n
	b = 0
	half = int(n / 2)
	for j in range(1, half):
		a = a + 2 ** j
	for j in range(half, n):
		b = b + 2 ** j
	print(abs(a - b))


def examA():
	T = I()
	ans = []
	for _ in range(T):
		N = I()
		cur = 2 ** N
		for i in range(1, N // 2):
			cur += 2 ** i
		for i in range(N // 2, N):
			cur -= 2 ** i
		ans.append(cur)
	for v in ans:
		print(v)
	return

def examB():
	T = I()
	ans = []
	for _ in range(T):
		cur = 0
		ans.append(cur)
	for v in ans:
		print(v)
	return

def examC():
	T = I()
	ans = []
	for _ in range(T):
		cur = 0
		ans.append(cur)
	for v in ans:
		print(v)
	return

def examD():
	ans = 0
	print(ans)
	return

def examE():
	ans = 0
	print(ans)
	return

def examF():
	ans = 0
	print(ans)
	return
import sys, bisect, itertools, heapq, math, random
from copy import deepcopy
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def I():
	return int(readline())

def LI():
	return list(map(int, readline().split()))

def LSI():
	return list(map(str, sys.stdin.readline().split()))

def LS():
	return sys.stdin.readline().split()

def SI():
	return sys.stdin.readline().strip()
global mod, mod2, inf, alphabet, _ep
mod = 10 ** 9 + 7
mod2 = 998244353
inf = 10 ** 18
_ep = 10 ** (-12)
alphabet = [chr(ord('a') + i) for i in range(26)]
sys.setrecursionlimit(10 ** 7)
examA()


for _ in range(int(input())):
	n = int(input())
	sum1 = 0
	sum2 = 0
	nd = 1
	for i in range(0, n):
		if i < n // 2 - 1 or i == n - 1:
			nd = nd * 2
			sum1 = sum1 + nd
		else:
			nd = nd * 2
			sum2 = sum2 + nd
	print(abs(sum1 - sum2))


def solve():
	n = int(input())
	a = 2 ** n
	b = 0
	i = 0
	j = n - 1
	x = 0
	while j > i and x < n // 2:
		b += 2 ** j
		j -= 1
		x += 1
	while j > i:
		a += 2 ** j
		j -= 1
	print(a - b)
t = int(input())
for i in range(t):
	solve()


out = ''
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = 2 ** n
	b = 0
	for i in range(1, n // 2):
		a += 2 ** i
	for i in range(n // 2, n):
		b += 2 ** i
	out += f'{a - b}\n'
print(out)


for _ in range(int(input())):
	coins = int(input())
	arr = [1 << i for i in range(1, coins + 1)]
	a = arr[-1]
	b = arr[-2]
	i = 0
	j = len(arr) - 3
	while i < j:
		a += arr[i]
		b += arr[j]
		i += 1
		j -= 1
	print(abs(a - b))


import sys
import math
t = int(input())
for _ in range(t):
	n = int(input())
	res = 2 * (2 ** (n // 2) - 1)
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	p1 = p2 = 0
	for i in range(1, n // 2):
		p1 += 1 << i
	for i in range(n // 2, n):
		p2 += 1 << i
	p1 += 1 << n
	print(p1 - p2)


t = int(input())
while t:
	n = int(input())
	(a, b) = (0, 0)
	d = n // 2
	for i in range(1, d):
		a += 2 ** i
	a += 2 ** n
	for i in range(d, n):
		b += 2 ** i
	if a - b < 0:
		(a, b) = (b, a)
	print(a - b)
	t -= 1


for _ in range(int(input())):
	c = int(input())
	ans = 0
	for i in range(1, c):
		if i < c / 2:
			ans += pow(2, i)
		else:
			ans -= pow(2, i)
	ans += pow(2, c)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	m = abs(2 * (1 - 2 ** int(n / 2)))
	print(m)


def split_balance(n):
	nums = [2 ** i for i in range(1, n + 1)]
	if len(nums) == 2:
		print(nums[-1] - nums[0])
		return
	reqSet = n // 2
	res = nums[-1]
	nums.pop(-1)
	reqSet -= 1
	i = 0
	while reqSet > 0:
		res += nums[0]
		nums.pop(0)
		reqSet -= 1
	print(res - sum(nums))

def main():
	t = int(input())
	while t > 0:
		split_balance(int(input()))
		t -= 1
main()


a = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824]
t = int(input())
for _ in range(t):
	n = int(input())
	c = 0
	b = 0
	ci = 0
	bi = 0
	for i in range(n - 1, -1, -1):
		if b > c and n // 2 - ci > 0:
			c += a[i]
			ci += 1
		else:
			b += a[i]
			bi += 1
	print(abs(b - c))


import math
from functools import reduce
t = int(input())
for i in range(t):
	li = []
	n = int(input())
	for j in range(1, n + 1):
		li.append(math.pow(2, j))
	l = li[:n // 2 - 1]
	l.append(li[n - 1])
	a = reduce(lambda x, y: x + y, l)
	l1 = li[n // 2 - 1:n - 1]
	b = reduce(lambda x, y: x + y, l1)
	print(int(abs(a - b)))


for t in range(int(input())):
	n = int(input())
	pile1 = 2 ** n + 2 ** (n // 2) - 2
	pile2 = 2 ** (n + 1) - 2 - pile1
	print(abs(pile1 - pile2))


t = int(input())
for j in range(t):
	a = 0
	b = 0
	n = int(input())
	n1 = int(n / 2)
	for i in range(1, n1 + 1):
		if i >= n1 or i != n:
			a = a + pow(2, i)
		elif i << n1 or i == n:
			b = b + pow(2, i)
	print(abs(a - b))


from collections import *
from itertools import *
from functools import *
import sys
import os
import time
timer = False
debug = False

def timeit(method):

	def wrapper(*args, **kwargs):
		mname = method.__name__
		if debug:
			print('{}(args:{}, kwargs:{})'.format(mname, args, kwargs))
		if timer:
			ts = time.time()
		result = method(*args, **kwargs)
		if timer:
			te = time.time()
			print('%r  %2.2f ms' % (mname, (te - ts) * 1000))
		return result
	return wrapper

def read_ints():
	return list(map(int, input().split()))

def read_floats():
	return list(map(float, input().split()))

def read_strs():
	return input().split()

@timeit
def main():
	t = int(input())
	for _ in range(t):
		a = 0
		n = int(input())
		total = 0
		for i in range(1, n + 1):
			total += pow(2, i)
			if 1 <= i <= n // 2 - 1 or i == n:
				a += pow(2, i)
		b = total - a
		print(abs(a - b))
main()


case = int(input())
for i in range(case):
	n = int(input())
	p1 = 0
	p2 = 0
	for j in range(1, n):
		if j < n / 2:
			p1 += 2 ** j
		else:
			p2 += 2 ** j
	p1 += 2 ** n
	ans = p1 - p2
	print(ans)


import sys
from math import sqrt, floor, factorial, gcd
from collections import Counter
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def a():
	ans = ''
	for _ in range(int(inp())):
		n = int(inp())
		s = 2
		m = 2
		for i in range(1, n // 2):
			s += 2 ** m
			m += 1
		ans += str(s) + '\n'
	print(ans)
a()


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	for i in range(1, n + 1):
		a.append(pow(2, i))
	x = int(n / 2) - 1
	l = []
	l = a[:x]
	l.append(a[-1])
	a = a[x:-1]
	dif = abs(sum(a) - sum(l))
	print(dif)


import math
from collections import Counter

def solve():
	n = int(input())
	if n == 2:
		print(2)
		return
	sum1 = 0
	sum2 = 0
	v = n // 2
	for i in range(1, v):
		sum1 += pow(2, i)
	sum1 += pow(2, n)
	for j in range(v, n):
		sum2 += pow(2, j)
	print(abs(sum1 - sum2))
for _ in range(int(input())):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	hn = n // 2
	sm1 = pow(2, n)
	sm2 = 0
	for j in range(1, hn):
		sm1 += pow(2, j)
	for j in range(hn, n):
		sm2 += pow(2, j)
	print(sm1 - sm2)


for _ in range(int(input())):
	n = int(input())
	x1 = 0
	x2 = 0
	for i in range(1, n // 2):
		x1 += pow(2, i)
	for i in range(n // 2, n):
		x2 += pow(2, i)
	print(pow(2, n) + x1 - x2)


test = int(input())
for i in range(test):
	n = int(input())
	sol = []
	temp = []
	ans = 0
	for i in range(1, n + 1):
		temp.append(2 ** i)
	for i in range(n // 2 - 1, -1, -1):
		sol.append(temp[i] - temp[n // 2 + i])
	print(abs(sol[0] - sum(sol[1:])))


while True:
	try:
		t = eval(input())
		for i in range(t):
			n = eval(input())
			print(pow(2, n // 2 + 1) - 2)
	except:
		break


from sys import stdin, stdout
arr = [pow(2, i) for i in range(31)]
arr[0] = 0
for i in range(1, len(arr)):
	arr[i] = arr[i] + arr[i - 1]
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	total = arr[n]
	t2 = n // 2
	a = 0
	b = 0
	for i in range(1, t2):
		a += pow(2, i)
	a += pow(2, n)
	b = total - a
	stdout.write(str(abs(b - a)) + '\n')


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print(2)
	else:
		suma = 0
		sumb = 0
		li = []
		for j in range(1, n + 1):
			li.append(2 ** j)
		for j in range(n // 2 - 1, n - 1):
			suma += li[j]
			li[j] = -1
		for j in range(len(li)):
			if li[j] != -1:
				sumb += li[j]
		print(abs(sumb - suma))


test = int(input())
for _ in range(test):
	n = int(input())
	m1 = 2 ** n
	m2 = 0
	for i in range(1, n):
		if i >= n // 2:
			m2 += 2 ** i
		else:
			m1 += 2 ** i
	print(m1 - m2)


n = int(input())
lista = []
for i in range(n):
	coins = int(input())
	for j in range(1, coins + 1):
		lista.append(2 ** j)
	grupoA = 1
	grupoB = somaB = 0
	somaA = lista[coins - 1]
	idc = 0
	while grupoA < coins // 2:
		somaA += lista[idc]
		grupoA += 1
		idc += 1
	while grupoB < coins // 2:
		somaB += lista[idc]
		grupoB += 1
		idc += 1
	print('{}'.format(somaA - somaB))
	lista = []


def solve(arr, n):
	(A, B) = (0, 0)
	index = int(n / 2)
	A = sum(arr[:index - 1]) + arr[-1]
	B = sum(arr[index - 1:n - 1])
	return abs(A - B)
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(pow(2, i + 1)) for i in range(n)]
	print(solve(arr, n))


l = [pow(2, x) for x in range(1, 31)]
for _ in range(int(input())):
	n = int(input())
	s = 0
	for i in range(n // 2 - 1):
		s += l[i]
	s += l[n - 1]
	r = 0
	for i in range(n // 2 - 1, n - 1):
		r += l[i]
	print(s - r)


t = int(input())
for i in range(t):
	n = int(input())
	l_coins = []
	for j in range(1, n + 1):
		l_coins.append(2 ** j)
	print(l_coins[-1] + sum(l_coins[0:int(n / 2) - 1]) - sum(l_coins[int(n / 2) - 1:n - 1]))


for x in range(int(input())):
	n = int(input())
	lst = list()
	i = 1
	while i <= n:
		lst.append(pow(2, i))
		i += 1
	j = 1
	p = 0
	a = 0
	while j <= n // 2:
		if j == 1:
			a = lst[n - 1]
		else:
			a = a + lst[p]
			p += 1
		j += 1
	c = sum(lst) - a
	print(abs(c - a))


def read_int():
	return int(input().strip())

def read_ints():
	return list(map(int, input().strip().split(' ')))

def solve():
	n = read_int()
	left = 2 ** n
	right = 0
	for i in range(1, n):
		if i < n // 2:
			left += 2 ** i
		else:
			right += 2 ** i
	return abs(left - right)
T = read_int()
for _ in range(T):
	print(solve())


case = int(input())
for i in range(0, case):
	n = int(input())
	sum1 = 0
	sum2 = 0
	for j in range(1, n + 1):
		if j < int(n / 2) or j == n:
			sum1 += 2 ** j
		else:
			sum1 -= 2 ** j
	print(abs(sum1))


n = int(input())
for i in range(n):
	n1 = int(input())
	li = [2 ** i for i in range(1, n1 + 1)]
	ans = 0
	for i in range(len(li) // 2):
		ans += li[i]
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	b = 0
	c = 0
	p = 2
	for i in range(n // 2 - 1):
		b += p
		p *= 2
	for i in range(n // 2):
		c += p
		p *= 2
	b += p
	print(b - c)


T = int(input())
for t in range(T):
	N = int(input())
	s1 = 2 ** N
	s2 = 0
	for i in range(1, N // 2):
		s1 += 2 ** i
	for i in range(N // 2, N):
		s2 += 2 ** i
	print(abs(s2 - s1))


t = int(input())
while t:
	n = int(input())
	diff = 2
	for i in range(1, int(n / 2)):
		diff = diff + 2 * 2 ** i
	print(diff)
	t = t - 1


for i in range(int(input())):
	a = int(input())
	b = []
	for j in range(1, a + 1):
		b.append(pow(2, j))
	if a <= 2:
		print(b[-1] - b[0])
	else:
		c = sum(b[0:a // 2 - 1]) + b[-1]
		d = sum(b[a // 2 - 1:a - 1])
		print(c - d)


t = int(input())
for i in range(t):
	n = int(input())
	weights = []
	for j in range(1, n + 1):
		weights.append(pow(2, j))
	sum1 = weights[n - 1]
	sum2 = 0
	count = 1
	for k in range(n - 1):
		if count < n // 2:
			sum1 = sum1 + weights[k]
			count = count + 1
		else:
			sum2 = sum2 + weights[k]
	print(abs(sum1 - sum2))


t = int(input())
for i in range(t):
	first = 0
	second = 0
	n = int(input())
	for j in range(n - 1, int(n / 2) - 1, -1):
		second += 2 ** j
	for j in range(1, int(n / 2), 1):
		first += 2 ** j
	first += 2 ** n
	print(abs(first - second))


T = int(input())
for _ in range(T):
	n = int(input())
	k = n // 2
	(a, b) = (0, 0)
	for i in range(1, k):
		a += 2 ** i
	a += 2 ** n
	for j in range(k, n):
		b += 2 ** j
	print(a - b)


for y in range(int(input())):
	sum1 = sum2 = 0
	n = int(input())
	for i in range(1, n // 2):
		sum1 += 1 << i
	sum1 += 1 << n
	for i in range(n // 2, n):
		sum2 += 1 << i
	print(sum1 - sum2)


T = int(input())
for t in range(T):
	N = int(input())
	ans = 0
	val = 1
	for i in range(1, N // 2):
		val <<= 1
		ans += val
	for j in range(N // 2, N):
		ans -= 1 << j
	print(abs(ans + (1 << N)))


t = int(input())
for _ in range(t):
	n = int(input())
	result = 2 ** (n // 2 + 1) - 2
	print(result)


t = int(input())
for _ in range(t):
	n = int(input())
	sub1 = 2 ** n
	sub2 = 0
	for i in range(1, n // 2):
		sub1 += 2 ** i
	for j in range(n // 2, n):
		sub2 += 2 ** j
	print(sub1 - sub2)


t = int(input())
pot = 2
while t > 0:
	t -= 1
	n = int(input())
	d = 0
	tmp = 1
	c = 0
	for i in range(n - 1):
		c += 1
		tmp *= 2
		if c >= n // 2:
			d -= tmp
		else:
			d += tmp
	d += tmp * 2
	print(d)


from sys import exit, stdin, stdout
import math

def main():
	T = int(input())
	for _ in range(T):
		n = int(input())
		one = []
		two = []
		for i in range(1, n // 2):
			one.append(2 ** i)
		one.append(2 ** n)
		for i in range(n // 2, n):
			two.append(2 ** i)
		print(abs(sum(one) - sum(two)))
main()


for _ in range(int(input())):
	n = int(input())
	x = 1 << n
	sumi = x
	for i in range(n // 2):
		x = x >> 1
		sumi -= x
	for i in range(n // 2 - 1):
		x = x >> 1
		sumi += x
	print(sumi)


from sys import stdin
import math
inp = lambda : stdin.readline().strip()
t = int(inp())
for i in range(t):
	n = int(inp())
	print(int(2 ** (n / 2 + 1) - 2))


def find(n):
	ans = 2 ** n - 2 ** (n - 1)
	for i in range(1, n // 2):
		ans += 2 ** i
		ans -= 2 ** (n - i - 1)
	return abs(ans)
t = int(input())
a = []
for _ in range(t):
	a.append(int(input()))
for i in a:
	print(find(i))


from collections import *

def io():
	return map(int, input().split())

def op():
	return list(map(int, input().split()))
for _ in range(int(input())):
	n = int(input())
	l = []
	q = 1
	for i in range(n):
		l.append(2 ** q)
		q += 1
	x = n // 2
	l1 = []
	l1.append(l.pop())
	for i in range(x - 1):
		l1.append(l.pop(0))
	print(abs(sum(l1) - sum(l)))


t = int(input())
while t:
	n = int(input())
	l1 = []
	for i in range(1, n + 1):
		l1.append(2 ** i)
	l1.sort()
	l2 = []
	l3 = []
	for i in range(n // 2 - 1):
		l2.append(l1[i])
	l2.append(max(l1))
	for i in range(n // 2 - 1, len(l1) - 1):
		l3.append(l1[i])
	print(sum(l2) - sum(l3))
	t = t - 1


import collections, heapq, itertools, math
groupby = itertools.groupby
rs = lambda : input()
ri = lambda : int(input())
rm = lambda : map(int, input().split())
rai = lambda : [int(x) for x in input().split()]

def solve(n):
	l = r = 0
	l += 2 ** n
	for i in range(1, n // 2):
		l += 2 ** i
	for i in range(n // 2, n):
		r += 2 ** i
	return abs(l - r)
for _ in range(ri()):
	n = ri()
	print(solve(n))


for i in range(int(input())):
	x = int(input())
	(a, b) = (0, 0)
	for j in range(1, x // 2):
		a += pow(2, j)
	for k in range(x // 2, x):
		b += pow(2, k)
	print(a + pow(2, x) - b)


t = int(input())
count = 0
while count < t:
	n = int(input())
	e = n / 2 + 1
	print(int(2 ** e - 2))
	count += 1


nbtest = int(input())
for i in range(nbtest):
	n = int(input())
	somme = 2 ** n
	for j in range(1, n // 2):
		somme += 2 ** j
	print(-2 ** (n + 1) + 2 * somme + 2)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest, _heapify_max, _heapreplace_max
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def outln(var):
	sys.stdout.write(str(var) + '\n')

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]

def input_matrix():
	mat = []
	for i in range(5):
		mat.append(l())

def ans(n):
	l = []
	n = int(n[0])
	a = []
	b = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	i = 0
	j = 1
	k = 0
	sa = l[-1]
	sb = 0
	while k < n // 2 - 1:
		sa = sa + l[k]
		k += 1
	m = n // 2 - 1
	while m < n - 1:
		sb = sb + l[m]
		m = m + 1
	diff = abs(sa - sb)
	return diff
t = int(data())
temp = []
for _ in range(t):
	temp.append(l())
for (i, n) in enumerate(temp):
	print(ans(n))


a = int(input())
l = []
for i in range(a):
	n = int(input())
	l.append(n)
for i in range(a):
	n = l[i]
	if n == 2:
		print(2)
	else:
		c = 2 ** n + 2 * (2 ** (n / 2 - 1) - 1)
		d = 2 * (2 ** n - 1) - c
		print(int(c - d))


n = int(input())
for i in range(n):
	a = int(input())
	k = []
	for i in range(1, a + 1):
		k.append(2 ** i)
	c = k[-1]
	p = 0
	x = a // 2
	for i in range(0, x - 1):
		c += k[i]
	for i in range(x - 1, a - 1):
		p += k[i]
	print(abs(c - p))


po = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824]
for _ in range(int(input())):
	n = int(input())
	l = po[1:n + 1]
	su1 = 0
	for i in range(n // 2):
		su1 += l[n - i - 2]
	print(sum(l) - su1 - su1)


t = int(input())
for i in range(t):
	n = int(input())
	print(int(2 ** (n / 2 + 1) - 2))


two = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824]
t = int(input())
for _ in range(t):
	n = int(input())
	a = two[:n]
	s = a[-1]
	a.pop()
	x = n // 2 - 1
	s += sum(a[:x])
	print(abs(s - sum(a[x:])))


from math import pow
t = int(input())
for i in range(t):
	n = int(input())
	sum1 = 0
	sum2 = 0
	for i in range(1, n):
		if i < n // 2:
			sum1 += pow(2, i)
		else:
			sum2 += pow(2, i)
	sum1 += pow(2, n)
	print(int(sum1 - sum2))


t = int(input())
while t > 0:
	n = int(input())
	m = n // 2
	(a, b) = (0, 0)
	for i in range(n - 1, n - m - 1, -1):
		a += 1 << i
	for i in range(1, n - m):
		b += 1 << i
	b += 1 << n
	print(abs(a - b))
	t = t - 1


def solve(n):
	g1 = 2 ** n + 2 * (2 ** (n // 2 - 1) - 1)
	g2 = 2 * (2 ** n - 1) - g1
	return abs(g1 - g2)
t = int(input())
for _ in range(t):
	n = int(input())
	result = solve(n)
	print(result)


def process_test_case(i_test):
	n = int(input())
	n_sum = pow(2, n + 1) - 2
	left_sum = pow(2, n) + pow(2, n // 2) - 2
	right_sum = n_sum - left_sum
	print(int(abs(left_sum - right_sum)))
	return None
n_tests = int(input())
for i_test in range(1, n_tests + 1):
	process_test_case(i_test)


def solve(n):
	k = n - int(n / 2)
	m = 0
	d = 2 ** n
	for i in range(k, n):
		m += 2 ** i
	for s in range(1, k):
		d += 2 ** s
	print(abs(d - m))
n = int(input())
list = []
for i in range(n):
	list.append(int(input()))
for i in range(n):
	solve(list[i])


T = int(input())

def minimize():
	n = int(input())
	ls = []
	a = 0
	b = 0
	for i in range(1, n + 1):
		ls.append(2 ** i)
	for i in range(len(ls)):
		if i < n / 2 - 1 or i == n - 1:
			a += ls[i]
		else:
			b += ls[i]
	print(a - b)
for _ in range(T):
	minimize()


arr = [2]
for i in range(1, 31):
	arr.append(arr[i - 1] * 2 + 2)
test = int(input())
for i in range(test):
	n = int(input())
	print(arr[n // 2 - 1])


for _ in range(int(input())):
	n = int(input())
	s = (1 << n + 1) - 2
	for i in range(n // 2):
		s -= 1 << n - i
	print(s)


def gp(a, t):
	return a * (2 ** t - 1)
for _ in range(int(input())):
	n = int(input())
	sum1 = 2 ** n + gp(2, n / 2 - 1)
	sum2 = gp(2 ** (n / 2), n / 2)
	print(int(abs(sum1 - sum2)))


t = int(input())
p = [0]
for i in range(1, 16):
	p.append(2 ** i)
for i in range(t):
	n = int(input())
	x = p[n // 2]
	y = sum(p[:n // 2])
	print(x + y)


t = int(input())
for _ in range(t):
	n = int(input())
	a = 2
	b = 0
	if n > 2:
		a += pow(2, n)
		for i in range(2, n // 2):
			a += pow(2, i)
		for i in range(n // 2, n):
			b += pow(2, i)
	print(abs(a - b))


for i in range(int(input())):
	n = int(input())
	suma = 2 ** (n + 1) - 2
	b = 2 ** n + 2 ** int(n / 2) - 2
	a = suma - b
	print(b - a)


testCount = int(input())
for _ in range(testCount):
	n = int(input())
	firstSum = 2 ** n
	secondSum = 0
	for i in range(1, n // 2):
		firstSum += 2 ** i
	for i in range(n // 2, n):
		secondSum += 2 ** i
	print(firstSum - secondSum)


from sys import stdin
ip = stdin.readline
for _ in range(int(ip())):
	n = int(ip()) // 2 + 1
	ans = pow(2, n) - 2
	print(ans)


def go():
	n = int(input())
	a = 2 ** n + 2 ** (n // 2) - 2
	b = 2 ** (n + 1) - 2 ^ a
	return a - b
t = int(input())
ans = []
for _ in range(t):
	ans.append(str(go()))
print('\n'.join(ans))


import math
import sys
import heapq
from collections import deque, defaultdict
from itertools import permutations, combinations, combinations_with_replacement
from sys import *
import random
import os
mod = 10 ** 9 + 7
MAX = sys.maxsize
MIN = -sys.maxsize - 1

def isPrime(n):
	if n > 1:
		for i in range(2, n):
			if n % i == 0:
				return False
		else:
			return True
	else:
		return False

def isPanagram(s):
	alphabet = 'abcdefghijklmnopqrstuvwxyz'
	for char in alphabet:
		if char not in s.lower():
			return False
	return True

def isEqual(list1):
	if len(list1) < 0:
		res = True
	res = all((ele == list1[0] for ele in list1))
	if res:
		return True
	else:
		return False

def remove_duplicate(list1):
	final_list = []
	for i in list1:
		if i not in final_list:
			final_lis.append(i)
	return final_list

def solve():
	n = int(input())
	k = n // 2
	(x, y) = (2 ** n, 0)
	for i in range(1, n):
		if i < k:
			x += 2 ** i
		else:
			y += 2 ** i
	return abs(x - y)
t = int(stdin.readline())
for i in range(t):
	result = solve()
	stdout.write(str(result) + '\n')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		coin = int(input())
		yield (2 ** (coin // 2 + 1) - 2)
t = int(input())
ans = gift()
print(*ans, sep='\n')


from collections import defaultdict as dc
from heapq import *
import math
import bisect
import sys
from collections import deque as dq
from heapq import heapify, heappush, heappop
mod = 10 ** 9 + 7

def seive(n):
	p = [0] * (n + 1)
	p[0] = 1
	p[1] = 1
	for i in range(2, n + 1):
		if p[i] == 0:
			for j in range(i * 2, n + 1, i):
				p[j] = 1
	return p

def inp():
	p = int(input())
	return p

def line():
	p = list(map(int, input().split()))
	return p

def read_mat():
	n = inp()
	a = []
	for i in range(n):
		a.append(line())
	return a

def digit(n):
	s = str(n)
	p = 0
	for i in s:
		p += int(i) ** 2
	return p

def solve(a):
	p = [2 ** i for i in range(1, a + 1)]
	k = a // 2
	l = p[-1] + sum(p[:k - 1])
	r = sum(p) - l
	return abs(l - r)
for _ in range(inp()):
	n = inp()
	l = solve(n)
	print(l)


def answer():
	n = int(input())
	i = 1
	c = []
	while i <= n:
		j = int(input())
		c.append(int(2 ** (j / 2 + 1) - 2))
		n -= 1
	i = 0
	while i < len(c):
		print(c[i])
		i += 1
answer()


from collections import Counter
import math

def solve():
	n = int(input())
	array = [2 ** (i + 1) for i in range(n)]
	if n == 2:
		return 2
	a = array[n - 1]
	if n == 4:
		return 6
	i = 0
	while i < n / 2 - 1:
		a += array[i]
		i += 1
	while i < n - 1:
		a -= array[i]
		i += 1
	return abs(a)
for i in range(int(input())):
	print(solve())


def liczenieRoznicy(prefixy, potega, n):
	roznica = potega[n] - prefixy[n - 1] + 2 * prefixy[n // 2 - 1]
	return roznica
potegi = [1]
sumyPrefixowe = [0]
tymczasowa = 1
max = 0
for i in range(0, 30):
	tymczasowa = tymczasowa * 2
	max = max + tymczasowa
	sumyPrefixowe.append(max)
	potegi.append(tymczasowa)
testy = int(input())
for j in range(0, testy):
	N = int(input())
	wynik = liczenieRoznicy(sumyPrefixowe, potegi, N)
	print(wynik)


n1 = int(input())
for i in range(n1):
	n = int(input())
	l1 = [2 ** i for i in range(1, n + 1)]
	s1 = l1[n - 1] + sum(l1[:n // 2 - 1])
	s2 = sum(l1[n // 2 - 1:n - 1])
	print(s1 - s2)


n = int(input())
for i in range(n):
	t = int(input())
	arr = list(range(1, t + 1))
	cnt = int(t / 2)
	chk = 0
	sm1 = 2 ** arr.pop(-1)
	sm2 = 0
	for i in range(cnt - 1):
		sm1 += 2 ** arr.pop(0)
	for i in arr:
		sm2 += 2 ** i
	if sm1 > sm2:
		print(sm1 - sm2)
	else:
		print(sm2 - sm1)


power = []
val = 2
for i in range(1, 31):
	power.append(val)
	val *= 2
t = int(input())
for T in range(t):
	n = int(input())
	l = power[0:n]
	ans = 0
	if n == 2:
		print(2)
		continue
	v2 = sum(l[n // 2 - 1:-1])
	v1 = sum(l) - v2
	print(abs(v1 - v2))


for test in range(int(input())):
	n = int(input())
	s1 = 0
	s2 = 0
	c1 = 0
	c2 = 0
	for i in range(n, 0, -1):
		if s1 < s2 and c1 < n // 2:
			s1 += 2 ** i
			c1 += 1
		elif c2 >= n // 2:
			s1 += 2 ** i
			c1 += 1
		else:
			s2 += 2 ** i
			c2 += 1
	d = abs(s1 - s2)
	print(d)


t = int(input())
for q in range(t):
	n = int(input())
	valores = []
	p = n // 2
	for k in range(1, n + 1):
		valores.append(2 ** k)
	x = valores[n - 1]
	p -= 1
	y = 0
	for i in range(n - 1):
		if p > 0:
			x += valores[i]
			p -= 1
		else:
			y += valores[i]
	print(abs(x - y))


t = int(input())
for _ in range(t):
	n = int(input())
	(sum1, sum2) = (0, 0)
	(c1, c2) = (0, 0)
	for i in range(n, 0, -1):
		if sum1 <= sum2:
			if c1 < n / 2:
				sum1 += pow(2, i)
				c1 += 1
			else:
				sum2 += pow(2, i)
				c2 += 1
		elif c2 < n / 2:
			sum2 += pow(2, i)
			c2 += 1
		else:
			sum1 += pow(2, i)
			c1 += 1
	print(abs(sum1 - sum2))


def diff_split_piles(n):
	p1 = 0
	p2 = 0
	for i in range(1, n + 1):
		if i < n / 2:
			p1 += 2 ** i
		elif n / 2 <= i < n:
			p2 += 2 ** i
	return 2 ** n - (p2 - p1)

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		print(diff_split_piles(n))
main()


t = int(input())
while t != 0:
	n = int(input())
	l = []
	if n % 2 != 0:
		print(0)
	if n == 2:
		print(2)
	else:
		for i in range(1, n + 1):
			l.append(2 ** i)
		x = l[0:int((n - 2) / 2)]
		a1 = sum(x)
		a1 = a1 + l[n - 1]
		y = l[int((n - 2) / 2):n - 1]
		a2 = sum(y)
		a3 = abs(a1 - a2)
		print(a3)
	t -= 1


import sys
input = sys.stdin.readline

def getInt():
	return int(input())

def getVars():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def getStr():
	return input().strip()
t = getInt()
for _ in range(t):
	n = getInt()
	s1 = 2 ** n
	s2 = 0
	key = 0
	for i in range(n // 2 - 1):
		s1 += 2 ** (i + 1)
	for i in range(n // 2 - 1, n - 1):
		s2 += 2 ** (i + 1)
	print(s1 - s2)


from __future__ import division, print_function
from collections import *
from math import *
from itertools import *
from time import time
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	n = int(input())
	a = 0
	b = 0
	for i in range(n // 2, n):
		a += 1 << i
	for j in range(1, n // 2):
		b += 1 << j
	b += 1 << n
	print(b - a)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
while t:
	main()
	t -= 1


import math
for _ in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	for i in range(1, n + 1):
		if i < n // 2:
			a += int(math.pow(2, i))
		elif i == n:
			a += int(math.pow(2, i))
		else:
			b += int(math.pow(2, i))
	print(abs(a - b))


def mincoins(lis):
	mini = []
	for j in lis:
		(sum1, sum2) = (set(), set())
		step = [2 ** k for k in range(1, j + 1)]
		sum1.add(max(step))
		for s in range(int(len(step) / 2) - 1):
			sum1.add(step[s])
		for k in range(len(step)):
			if step[k] not in sum1:
				sum2.add(step[k])
		(max1, max2) = (sum(sum1), sum(sum2))
		mini.append(abs(max1 - max2))
	return mini
t = int(input())
lis = []
for i in range(t):
	lis.append(int(input()))
result = mincoins(lis)
print(*result, sep='\n')


t = int(input())
for _ in range(t):
	n = int(input())
	a = ['0'] * (n + 1)
	for i in range(1, n // 2):
		a[i] = '1'
	a[-1] = '1'
	a = reversed(a)
	a = ''.join(a)
	b = ['0'] * (n + 1)
	for i in range(n):
		if a[i] == '0':
			b[i] = '1'
	b = ''.join(b)
	print(abs(int(a, 2) - int(b, 2)))


t = int(input())
for i in range(t):
	n = int(input())
	s = 2 ** (n + 1) - 2
	l = 2 ** (n // 2 + 1) - 2
	print(abs(s - (s - l)))


tc = int(input())
while tc > 0:
	n = int(input())
	print((1 << n // 2 + 1) - 2)
	tc -= 1


t = int(input(''))
u = 0
while u < t:
	n = int(input(''))
	a = 0
	b = 0
	for i in range(1, n // 2):
		a += 2 ** i
	a += 2 ** n
	b = 0
	for w in range(n // 2, n):
		b += 2 ** w
	print(max(a, b) - min(a, b))
	u += 1


for _ in range(int(input())):
	n = int(input())
	a = [pow(2, x + 1) for x in range(n)]
	big = sum(a[:n // 2 - 1]) + a[-1]
	litile = sum(a[n // 2 - 1:-1])
	print(big - litile)


for _ in range(int(input())):
	n = int(input())
	arr = []
	for i in range(1, n + 1):
		arr.append(2 ** i)
	su = 0
	su += arr.pop()
	for i in range(n // 2 - 1):
		su += arr[0]
		del arr[0]
	print(abs(su - sum(arr)))


import sys
from itertools import islice
stdin = sys.stdin
t = int(stdin.readline())
for line in stdin:
	if not line:
		break
	n = int(line)
	k = n // 2
	pile1 = [2 ** n] + [2 ** i for i in range(1, k)]
	pile2 = [2 ** i for i in range(k, n)]
	print(sum(pile1) - sum(pile2))


a = [0] * 15
a[0] = 2
for i in range(1, 15):
	a[i] = a[i - 1] + 2 ** (i + 1)
z = int(input())
for i in range(z):
	q = int(input())
	print(a[q // 2 - 1])


t = int(input())
for i in range(t):
	n = int(input())
	l1 = 2 ** n
	l2 = 0
	for i in range(1, n // 2):
		l1 += 2 ** i
	for i in range(n // 2, n):
		l2 += 2 ** i
	print(l1 - l2)


n = int(input())
for i in range(n):
	numCoin = int(input())
	a = 0
	b = 0
	a += 2 ** numCoin
	for i in range(1, numCoin // 2):
		a += 2 ** i
	for i in range(numCoin // 2, numCoin):
		b += 2 ** i
	print(abs(a - b))


import math
for _ in range(int(input())):
	n = int(input())
	sum1 = 0
	sum2 = 0
	for i in range(1, n // 2):
		sum1 += pow(2, i)
	for i in range(n // 2, n):
		sum2 += pow(2, i)
	print(abs(pow(2, n) + sum1 - sum2))


for _ in range(int(input())):
	m = int(input())
	mid = int(m / 2)
	sum1 = 0
	sum2 = 0
	if m == 2:
		print((1 << 2) - (1 << 1))
	else:
		for i in range(1, mid):
			sum1 = sum1 + (1 << i)
		for i in range(mid, m):
			sum2 = sum2 + (1 << i)
		sum1 = sum1 + (1 << m)
		x = abs(sum1 - sum2)
		print(x)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
sys.setrecursionlimit(100000000)
ii = lambda : int(input())
si = lambda : input()
jn = lambda x, l: x.join(map(str, l))
sl = lambda : list(map(str, input().strip()))
mi = lambda : map(int, input().split())
mif = lambda : map(float, input().split())
lii = lambda : list(map(int, input().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
mod = 1000000007
for _ in range(ii()):
	n = ii()
	sol = pow(2, n // 2 + 1) - 2
	print(sol)


t = int(input())
for i in range(t):
	n = int(input())
	somaT = 2 * (2 ** n - 1)
	aux = 0
	somaAux = 0
	c = n - 1
	for j in range(n // 2):
		somaAux += 2 * 2 ** (c - 1)
		c -= 1
	print(somaT - somaAux - somaAux)


t = int(input())
pows = [2 ** i for i in range(1, 31)]
for i in range(t):
	n = int(input())
	lim = n // 2 - 1
	print(2 * (1 + sum(pows[:lim])))


import os
import sys
from io import BytesIO, IOBase
import math

def inputIntArray():
	return list(map(int, input().rstrip().split()))

def inputArray():
	return input().rstrip().split()

def inputVars():
	return map(int, input().rstrip().split())

def inputNum():
	return int(input())

def main():
	for _ in range(inputNum()):
		n = inputNum()
		lastElem = 2 ** n
		pileA = 2 * (2 ** (n // 2 - 1) - 1) + lastElem
		pileB = 2 ** (n // 2) * (2 ** (n // 2) - 1)
		print(abs(pileA - pileB))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())

def cnt(c):
	res = 2 ** c
	for i in range(1, c // 2):
		res += 2 ** i
	for i in range(c // 2, c):
		res -= 2 ** i
	return res
for i in range(n):
	print(cnt(int(input())))


k = []
k.append(0)
k.append(2)
m = 2
p = 2
for i in range(16):
	k.append(int(k[m - 1] + 2 ** p))
	m += 1
	p += 1
for i in range(int(input())):
	n = int(input())
	print(k[int(n / 2)])


x = int(input())
for i in range(x):
	l = []
	t = []
	n = int(input())
	a = list((int(2 ** i) for i in range(1, n + 1)))
	a.sort(reverse=True)
	l.append(a[0])
	t.append(a[1])
	i = 1
	while len(t) < n // 2:
		i += 1
		if sum(t) < sum(l):
			t.append(a[i])
		else:
			l.append(a[i])
	for i in range(i + 1, n):
		l.append(a[i])
	print(abs(sum(l) - sum(t)))


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	N = int(input())
	print(2 * (pow(2, N // 2) - 1))


import sys
from os import path
if path.exists('C:/Users/prana/Desktop/sublime/input.txt'):
	sys.stdin = open('C:/Users/prana/Desktop/sublime/input.txt', 'r')
	sys.stdout = open('C:/Users/prana/Desktop/sublime/output.txt', 'w')

def solve():
	n = int(input())
	ans1 = 2 ** (n + 1) - 2
	ans2 = 2 ** (n // 2) - 2 + 2 ** n
	print(2 * ans2 - ans1)
T = 1
T = int(input())
for _ in range(1, T + 1):
	print('Case #', _, file=sys.stderr)
	solve()


s = int(input(''))
for c in range(s):
	t = int(input(''))
	i = 1
	a = 0
	list = []
	while i <= t:
		list.append(pow(2, i))
		i += 1
	for d in range(t // 2 - 1, t - 1):
		a += list[d]
	print(sum(list) - 2 * a)


for _ in range(int(input())):
	n = int(input())
	l = []
	flag = 0
	for i in range(1, 31):
		l.append(2 ** i)
	b = 0
	c = 0
	for i in range(int(n / 2) - 1):
		b = b + l[i]
	b = b + l[n - 1]
	for i in range(int(n / 2) - 1, n - 1):
		c = c + l[i]
	print(abs(b - c))


n = int(input())
for j in range(n):
	k = int(input())
	sum1 = 2 ** k
	sum2 = 0
	for i in range(1, k // 2):
		sum1 += 2 ** i
	for i in range(k // 2, k):
		sum2 += 2 ** i
	print(sum1 - sum2)


t = int(input())
for _ in range(t):
	n = int(input())
	res = 0
	for i in range(n):
		if i < n // 2 - 1 or i == n - 1:
			res = res + 2 ** (i + 1)
		else:
			res = res - 2 ** (i + 1)
	print(res)


ans = []
for _ in range(int(input())):
	n = int(input())
	ansi = 2 ** n
	for i in range(1, n // 2):
		ansi += 2 ** i
	ans.append(ansi - (2 ** (n + 1) - 2 - ansi))
print('\n'.join(map(str, ans)))


T = int(input())
for case in range(T):
	N = int(input())
	first = 2 ** N + 2 ** (N // 2) - 2
	second = 2 ** (N + 1) - 2 - first
	print(first - second)


t = int(input())
for i in range(t):
	n = int(input())
	j = 1
	ans = 2 ** n
	while j <= n - 1:
		if j <= n / 2 - 1:
			ans = ans + 2 ** j
			j = j + 1
		else:
			ans = ans - 2 ** j
			j = j + 1
	print(ans)


for i in range(int(input())):
	a = int(input())
	s = 2 ** a + sum([2 ** x for x in range(1, a // 2)])
	s1 = sum([2 ** x for x in range(a // 2, a)])
	print(s - s1)


class PhoBal:

	def __init__(self, num):
		self.n = num

	def minimize_diff(self):
		(a, b) = (0, 0)
		j = 0
		for i in range(1, self.n // 2):
			a = a + 2 ** i
			j = self.n // 2 - 1 + i
			b = b + 2 ** j
		a += 2 ** self.n
		b += 2 ** (j + 1)
		diff = a - b if a > b else b - a
		return diff
T = int(input())
for t in range(1, T + 1):
	N = int(input())
	bal = PhoBal(N)
	diff = bal.minimize_diff()
	print(diff)


pow2 = [2 ** i for i in range(1, 31)]
pow2.insert(0, 1)
test = int(input())
for __ in range(test):
	n = int(input())
	end = pow2[n]
	limit = n // 2 - 1
	for i in range(limit):
		end += pow2[i + 1]
	sum1 = 0
	for i in range(1, n + 1):
		sum1 += pow2[i]
	a = sum1 - end
	print(abs(a - end))


t = int(input())
for _ in range(t):
	n = int(input())
	assert n % 2 == 0
	half = int(n / 2)
	s1 = 2 * (2 ** (half - 1) - 1) + 2 ** n
	s2 = 2 ** half * (2 ** half - 1)
	print(int(abs(s1 - s2)))


for _ in range(int(input())):
	n = int(input())
	a = [2 ** i for i in range(1, n + 1)]
	sm1 = a.pop()
	t = n // 2
	sm2 = 0
	while t > 0:
		sm2 += a.pop()
		t -= 1
	sm1 += sum(a)
	print(sm1 - sm2)


t = int(input())
while t > 0:
	n = int(input())
	li = []
	li2 = []
	li.append(2 ** n)
	for i in range(1, n):
		if i <= n // 2 - 1:
			li.append(2 ** i)
		else:
			li2.append(2 ** i)
	print(abs(sum(li) - sum(li2)))
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	ans = 2
	j = 4
	cnt = 1
	while cnt <= n // 2 - 1:
		ans += j
		j *= 2
		cnt += 1
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = pow(2, n) + pow(2, n / 2) - 2
	b = pow(2, n) - 2 - pow(2, n / 2) + 2
	print(int(a - b))


new = int(input())
for i in range(0, new):
	n = int(input())
	lis = []
	for i in range(1, n + 1):
		a = pow(2, i)
		lis.append(a)
	basic = len(lis) // 2
	total = lis[-1]
	lis.remove(total)
	for i in range(0, basic - 1):
		total = total + lis[0]
		lis.remove(lis[0])
	min_ = 0
	for i in lis:
		min_ = min_ + i
	print(total - min_)


t = int(input())
for i in range(t):
	n = int(input())
	a = 0
	b = 0
	if n == 2:
		print(2)
	else:
		for i in range(1, int(n / 2)):
			a += 2 ** i
		a += 2 ** n
		for j in range(int(n / 2), n):
			b += 2 ** j
		if a > b:
			print(a - b)
		else:
			print(b - a)


from sys import stdin
input = stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	a = 1 << n
	for i in range(1, n // 2):
		a += 1 << i
	for i in range(n // 2, n):
		a -= 1 << i
	print(a)


t = int(input())
arr = [1]
for _ in range(30):
	arr.append(2 * arr[-1])
for _ in range(t):
	n = int(input())
	sub_arr = arr[1:n + 1]
	right = sub_arr[-1]
	right += sum(sub_arr[:n // 2 - 1])
	left = sum(sub_arr[n // 2 - 1:-1])
	print(abs(right - left))


t = int(input())
alph = 'abcdefghijklmnopqrstuvwxyz'
for u in range(t):
	n = int(input())
	a = [2]
	for i in range(n - 1):
		a.append(a[i] * 2)
	sum1 = 0
	sum2 = 0
	sum1 = sum(a[0:n // 2 - 1])
	sum1 += a[-1]
	sum2 = sum(a) - sum1
	print(max(sum1, sum2) - min(sum1, sum2))


t = int(input())
while t > 0:
	list = []
	x = int(input())
	list = [2 ** n for n in range(1, x + 1)]
	if x == 2:
		print(abs(list[0] - list[1]))
	else:
		a_sum = list[len(list) - 1]
		b_sum = 0
		for i in range(0, len(list) // 2 - 1):
			a_sum += list[i]
		for i in range(len(list) // 2 - 1, len(list) - 1):
			b_sum += list[i]
		print(abs(a_sum - b_sum))
	t = t - 1


for i in range(int(input())):
	n = int(input())
	fh = 0
	sh = 0
	for i in range(1, n // 2):
		fh = fh + 2 ** i
	fh = fh + 2 ** n
	for i in range(n // 2, n):
		sh = sh + 2 ** i
	print(abs(fh - sh))


a = int(input())
i = 0
ansL = 0
while i < a:
	c = int(input())
	print(2 ** (c // 2) * 2 - 2)
	i = i + 1


k = int(input())
for i in range(k):
	x = int(input())
	list_value = [2 ** a for a in range(1, x + 2)]
	maximum = list_value.pop()
	list_value.reverse()
	for i in range(x // 2 - 1):
		maximum += list_value.pop()
	print(maximum - sum(list_value))


MOD = 10 ** 9 + 7

def main():
	for _ in inputt():
		(n,) = inputi()
		print(2 ** (n // 2 + 1) - 2)
from math import *
from heapq import *
from itertools import *
from functools import reduce, lru_cache, partial
from collections import Counter, defaultdict
import re, copy, operator, cmath
import sys, io, os, builtins
sys.setrecursionlimit(1000)
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	if args:
		sys.stdout.write(str(args[0]))
		split = kwargs.pop('split', ' ')
		for arg in args[1:]:
			sys.stdout.write(split)
			sys.stdout.write(str(arg))
	sys.stdout.write(kwargs.pop('end', '\n'))

def debug(*args, **kwargs):
	print('debug', *args, **kwargs)
	sys.stdout.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip()
inputt = lambda t=0: range(t) if t else range(int(input()))
inputs = lambda : input().split()
inputi = lambda k=int: map(k, inputs())
inputl = lambda t=0, k=lambda : list(inputi()): [k() for _ in range(t)] if t else list(k())

def len(a):
	if isinstance(a, range):
		return -((a.start - a.stop) // a.step)
	return builtins.len(a)

def bisect_left(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if key(a[mid]) < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def bisect_right(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if x < key(a[mid]):
			hi = mid
		else:
			lo = mid + 1
	return lo

def insort_left(a, x, key=None, lo=0, hi=None):
	lo = bisect_left(a, x, key, lo, hi)
	a.insert(lo, x)

def insort_right(a, x, key=None, lo=0, hi=None):
	lo = bisect_right(a, x, key, lo, hi)
	a.insert(lo, x)
do_nothing = lambda x: x
bisect = bisect_right
insort = insort_right

def index(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi and key(a[i]) == x:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_lt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_le(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_gt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_ge(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

class Tree:

	def __init__(n):
		self._n = n
		self._conn = [[] for _ in range(n)]
		self._list = [0] * n

	def connect(a, b):
		pass

class Sieve:

	def __init__(self):
		self._n = 6
		self._list = [2, 3, 5, 7, 11, 13]

	def extend(self, n):
		if n <= self._list[-1]:
			return
		maxbase = int(n ** 0.5) + 1
		self.extend(maxbase)
		begin = self._list[-1] + 1
		newsieve = [i for i in range(begin, n + 1)]
		for p in self.primerange(2, maxbase):
			for i in range(-begin % p, len(newsieve), p):
				newsieve[i] = 0
		self._list.extend([x for x in newsieve if x])

	def extend_to_no(self, i):
		while len(self._list) < i:
			self.extend(int(self._list[-1] * 1.5))

	def primerange(self, a, b):
		a = max(2, a)
		if a >= b:
			return
		self.extend(b)
		i = self.search(a)[1]
		maxi = len(self._list) + 1
		while i < maxi:
			p = self._list[i - 1]
			if p < b:
				yield p
				i += 1
			else:
				return

	def search(self, n):
		if n < 2:
			raise ValueError
		if n > self._list[-1]:
			self.extend(n)
		b = bisect(self._list, n)
		if self._list[b - 1] == n:
			return (b, b)
		else:
			return (b, b + 1)

	def __contains__(self, n):
		if n < 2:
			raise ValueError
		if not n % 2:
			return n == 2
		(a, b) = self.search(n)
		return a == b

	def __getitem__(self, n):
		if isinstance(n, slice):
			self.extend_to_no(n.stop + 1)
			return self._list[n.start:n.stop:n.step]
		else:
			self.extend_to_no(n + 1)
			return self._list[n]
sieve = Sieve()

def isprime(n):
	if n <= sieve._list[-1]:
		return n in sieve
	for i in sieve:
		if not n % i:
			return False
		if n < i * i:
			return True
prime = sieve.__getitem__
primerange = lambda a, b=0: sieve.primerange(a, b) if b else sieve.primerange(2, a)

def factorint(n):
	factors = []
	for i in sieve:
		if n < i * i:
			break
		while not n % i:
			factors.append(i)
			n //= i
	if n != 1:
		factors.append(n)
	return factors
factordict = lambda n: Counter(factorint(n))
main()


x = int(input())
for i in range(x):
	l = []
	s = int(input())
	for j in range(1, s + 1):
		l.append(2 ** j)
	g = 0
	for o in range(s // 2 - 1):
		g += l[o]
	g += l[len(l) - 1]
	k = 0
	for p in range(s // 2 - 1, s - 1):
		k += l[p]
	q = abs(g - k)
	print(q)


def findwhatever(n):
	i = 1
	leftside = 2 ** n
	leftcount = 1
	rightside = 0
	for c in range(1, n):
		if leftcount < n / 2:
			leftside += 2 ** c
			leftcount += 1
		else:
			rightside += 2 ** c
	print(abs(leftside - rightside))
a = int(input())
for i in range(a):
	n = int(input())
	findwhatever(n)


t = int(input())
for _ in range(t):
	n = int(input())
	ans = 2 ** (n // 2) * 2 - 2
	print(ans)


t = int(input())
while t > 0:
	n = int(input())
	result = 2 ** n
	for x in range(1, int(n / 2)):
		result = result + 2 ** x - 2 ** (n - x)
	result = result - 2 ** (n - int(n / 2))
	print(result)
	t = t - 1


for _ in range(int(input())):
	print(2 ** ((int(input()) + 2) // 2) - 2)


def sublist(A):
	B = []
	for i in range(len(A) + 1):
		for j in range(i + 1, len(A) + 1):
			sub = A[i:j]
			B.append(sub)
	return B

def minisum(A, B, shalf):
	ssize = int(len(A) / 2)
	mini = sum(A)
	for i in B:
		if len(i) == ssize:
			ssum = sum(i)
			sub = abs(shalf - ssum)
			if mini > sub:
				mini = sub
				j = i
	return (j, mini)
t = int(input())
x = 0
main = []
while x < t:
	n = int(input())
	main.append(n)
	x += 1
for i in main:
	n = []
	for j in range(i):
		a = 2 ** (j + 1)
		n.append(a)
	S = sum(n)
	shalf = int(S / 2)
	k = sublist(n)
	(j, mini) = minisum(n, k, shalf)
	l = sum(j)
	q = S - l
	ans = abs(q - l)
	print(ans)


t = int(input())
res = []
for i in range(t):
	n = int(input())
	arr = []
	for i in range(1, n + 1):
		arr.append(2 ** i)
	end = n // 2
	sum1 = arr[len(arr) - 1] + sum(arr[0:end - 1])
	sum2 = sum(arr[end - 1:len(arr) - 1])
	res.append(abs(sum1 - sum2))
for r in res:
	print(r)


a = int(input())
h = []
for i in range(0, a):
	q = int(input())
	c = 0
	k = []
	for i in range(1, q + 1):
		k.append(2 ** i)
	for i in range(0, int(q / 2)):
		c += k[i]
	h.append(c)
print(*h, sep='\n')


tbl = [2, 6, 14, 30, 62, 126, 254, 510, 1022, 2046, 4094, 8190, 16382, 32766, 65534]
for i in range(int(input())):
	print(tbl[int(input()) // 2 - 1])


testcase = int(input())
for t in range(1, testcase + 1):
	n = int(input())
	elems = [2 ** (i + 1) for i in range(n)]
	elems_t = [elems.pop(n - 1)]
	i = 1
	while i < n / 2:
		elems_t.append(elems.pop(0))
		i += 1
	print(abs(sum(elems_t) - sum(elems)))


for _ in range(int(input())):
	n = int(input())
	l = [2 ** i for i in range(1, n + 1)]
	h = []
	h.append(l[-1])
	l = l[:len(l) - 1]
	while len(h) != len(l):
		h.append(l[0])
		l = l[1:]
	print(abs(sum(h) - sum(l)))


t = int(input())
for _ in range(t):
	n = int(input())
	k = int(n / 2)
	z = pow(2, k + 1) - 2
	print(z)


from math import gcd

def rn():
	a = int(input())
	return a

def rl():
	a = list(map(int, input().split()))
	return a
for _ in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	c = 1
	for i in range(n // 2 - 1):
		c = c << 1
		a += c
	for i in range(n // 2):
		c = c << 1
		b += c
	c = c << 1
	a += c
	print(abs(a - b))


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	b = []
	c = 0
	a.append(2 ** n)
	for i in range(n - 1, 0, -1):
		if len(b) < n // 2:
			b.append(2 ** i)
		else:
			a.append(2 ** i)
	print(abs(sum(a) - sum(b)))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	for x in range(1, n + 1):
		arr.append(1 << x)
	l = arr[-1] + sum(arr[:n // 2 - 1])
	r = sum(arr) - l
	print(abs(r - l))


def fun(x):
	lst1 = list()
	for i in range(1, x + 1):
		lst1.append(2 ** i)
	y = int(x / 2) - 1
	a = lst1[-1] + sum(lst1[:y])
	b = sum(lst1[y:-1])
	return abs(a - b)
n = int(input())
lst = list()
for i in range(n):
	lst.append(int(input()))
for i in range(n):
	print(fun(lst[i]))


t = int(input())
sol = []
for tc in range(t):
	n = int(input())
	a = [2 ** i for i in range(1, n // 2)]
	a.append(2 ** n)
	b = [2 ** i for i in range(n // 2, n)]
	sol.append(sum(a) - sum(b))
for s in sol:
	print(s)


import sys
cases = int(sys.stdin.readline())
for _ in range(cases):
	n = int(sys.stdin.readline())
	print(2 ** (n // 2 + 1) - 2)


def main():
	n = int(input())
	sm = 0
	for i in range(1, n // 2):
		sm += 2 ** i
	for i in range(n // 2, n):
		sm -= 2 ** i
	sm += 2 ** n
	print(sm)

def __starting_point():
	t = int(input())
	for i in range(t):
		main()
__starting_point()


from sys import stdin, stdout
from math import *
a = [2 ** i for i in range(1, 31)]
for __ in range(int(input())):
	n = int(input())
	s = sum(a[:n // 2 - 1]) + a[n - 1]
	s2 = sum(a[n // 2 - 1:n - 1])
	print(abs(s - s2))


for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(2)
		continue
	a = []
	for i in range(1, n + 1):
		a.append(pow(2, i))
	num1 = 0
	num2 = 0
	f = 0
	c = 0
	for i in range(n // 2 - 1):
		num1 += a[i]
	num1 += a[n - 1]
	print(abs(sum(a) - 2 * num1))


moneys = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824]

def solve():
	n = int(input())
	arr = moneys[:n]
	(first, second) = (0, 0)
	for i in range(n):
		if i < n // 2 - 1 or i == n - 1:
			first += arr[i]
		else:
			second += arr[i]
	print(abs(first - second))

def main():
	for _ in range(int(input())):
		solve()
main()


t = int(input())
for i in range(t):
	n = int(input())
	m = int(n / 2)
	count = 0
	count += 2 ** n
	m -= 1
	for j in range(1, m + 1):
		count += 2 ** j
	count1 = 0
	for j in range(m + 1, n):
		count1 += 2 ** j
	print(count - count1)


t = int(input())
for i in range(t):
	n = int(input())
	a = int(n / 2)
	l = 0
	r = 0
	for j in range(1, a):
		l += 2 ** j
	for k in range(a, n):
		r += 2 ** k
	print(2 ** n + l - r)


for i in range(int(input())):
	n = int(input())
	a = [2]
	y = 0
	for i in range(2, n + 1):
		a.append(2 ** i)
	y += a[-1]
	for x in range(n // 2 - 1):
		y += a[x]
	for q in range(n // 2 - 1, n - 1):
		y -= a[q]
	print(y)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	p = int(input())
	a = 0
	m = 2 ** (p + 1) - 2
	for i in range(p - 1, p - 1 - p // 2, -1):
		a += 2 ** i
		m -= 2 ** i
	print(m - a)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		sq = [2 ** i for i in range(1, n + 1)]
		sum1 = sq[-1] + sum(sq[:int(n / 2 - 1)])
		sum2 = sum(sq[int(n / 2 - 1):-1])
		print(sum1 - sum2)
main()


hahs = [0] * 16
val = 2
for i in range(1, 16):
	hahs[i] = hahs[i - 1] + val
	val *= 2
for _ in range(int(input())):
	n = int(input())
	print(hahs[n // 2])


t = int(input())
while t:
	t -= 1
	n = int(input())
	p1 = 2 ** n
	p2 = 0
	for i in range(1, n // 2):
		p1 += 2 ** i
	for i in range(n // 2, n):
		p2 += 2 ** i
	print(abs(p1 - p2))


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	A = []
	for i in range(1, N + 1):
		A.append(2 ** i)
	a = b = 0
	a += A.pop()
	for i in range(N // 2):
		b += A.pop()
	a += sum(A)
	ans = abs(a - b)
	print(ans)


def findDiff(n):
	s0 = 2 ** n
	s1 = 0
	k = n // 2
	for i in range(1, k):
		s0 += 2 ** i
	for i in range(k, n):
		s1 += 2 ** i
	return abs(s0 - s1)

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		print(findDiff(n))
main()


import sys
from sys import stdin, stdout

def R():
	return map(int, stdin.readline().strip().split())
arr = [2 ** i for i in range(31)]
ans = []
for h in range(int(stdin.readline().strip())):
	n = int(stdin.readline().strip())
	t = n // 2
	ans.append(str(sum(arr[1:t]) + arr[n] - sum(arr[t:n])))
stdout.write('\n'.join(ans))


for _ in range(int(input())):
	n = int(input())
	x = 2 ** n
	z = n // 2
	summ = x
	for i in range(1, z):
		summ += 2 ** i
	for a in range(z, n):
		summ -= 2 ** a
	print(summ)


from sys import stdin, stdout
Pi = lambda x: stdout.write(str(x) + '\n')
Ps = lambda x: stdout.write(str(x))
S = lambda x: x * (x + 1) // 2
I = lambda x: 1 + 2 * x
R = lambda : stdin.readline()
Ri = lambda x: map(int, x.split())
Rs = lambda x: map(str, x.split())
Rf = lambda x: map(float, x.split())
MaxN = int(1000.0) + 5

def f(dp, n):
	mn = 1
	while 1:
		k = 1
		good = 1
		while n - 2 * k >= 0 and good:
			if mn == 2 * dp[n - k] - dp[n - 2 * k]:
				good = 0
			k += 1
		if good:
			return mn
		mn += 1

def main():
	t = int(R())
	for i in range(t):
		n = int(R())
		A = []
		for i in range(1, n + 1):
			A.append(1 << i)
		a = A[-1]
		n //= 2
		for i in range(n - 1):
			a += A[i]
		b = sum(A) - a
		Pi(abs(a - b))
main()


t = int(input())
for _ in range(t):
	n = int(input())
	if n is 2:
		print(2)
	else:
		weights = [2 ** i for i in range(1, n + 1)]
		a = weights[n - 1] + sum(weights[:n // 2 - 1])
		b = sum(weights[n // 2 - 1:n - 1])
		print(a - b)


for query in range(int(input())):
	n = int(input())
	a = 2 ** (n // 2) - 2 + 2 ** n
	b = 2 ** n - 2 ** (n // 2)
	print(abs(a - b))


t = int(input())
r = [2 ** i for i in range(1, 31)]
while t > 0:
	t = t - 1
	n = int(input())
	a = 0
	b = 0
	if n == 2:
		print(2)
		continue
	a += r[n - 1]
	half = n / 2
	for i in range(n - 2, -1, -1):
		if half > 0:
			b += r[i]
			half -= 1
		else:
			a += r[i]
	print(abs(a - b))


qq = []
t = int(input())
e = 1
for i in range(0, 32):
	e = e * 2
	qq.append(e)
for _ in range(0, t):
	n = int(input())
	res = 0
	if n == 2:
		print(2)
	else:
		res = qq[n - 1]
		for i in range(0, n - 1):
			if i < n // 2 - 1:
				res += qq[i]
			else:
				res -= qq[i]
		print(abs(res))


t = int(input())
a = [2]
for i9 in range(2, 31):
	a.append(2 * a[i9 - 2])
for i10 in range(t):
	n = int(input())
	s = 0
	for i in range(n // 2 - 1):
		s += a[i]
	s += a[n - 1]
	c = 0
	for i in range(n // 2 - 1, n - 1):
		c += a[i]
	print(abs(s - c))


n = int(input())
res = []
for i in range(1, 30):
	res.append(2 ** i)
main = []
for i in range(n):
	no = int(input())
	if no == 2:
		main.append(2)
	elif no == 30:
		main.append(65534)
	else:
		res2 = res[0:no]
		len_res2 = len(res2)
		split = int(len_res2 / 2)
		sum1 = res2[:split - 1]
		sum1.append(max(res2))
		sum2 = res2[split - 1:len_res2 - 1]
		main.append(sum(sum1) - sum(sum2))
for i in main:
	print(i)


t = int(input())
for i in range(0, t):
	n = int(input())
	m = int(n / 2)
	val1 = pow(2, m) - 2 + pow(2, n)
	val2 = pow(2, 2 * m) - pow(2, m)
	print(val1 - val2)


t = int(input())
sum = 0
for i in range(t):
	n = int(input())
	n1 = (n + 1) / 2
	n2 = int(n1)
	sum = 0
	for i in range(1, n2 + 1):
		sum = sum + 2 ** i
	print(sum)


t = int(input())
for x in range(t):
	n = int(input())
	k = n // 2
	a = 2 ** n + 2 ** k - 2
	b = 2 ** (n + 1) - 2 - a
	print(abs(a - b))


output = []
for i in range(int(input())):
	n = int(input())
	coins = [2 ** j for j in range(1, n + 1)]
	output.append(coins[-1] + sum(coins[:n // 2 - 1]) - sum(coins[n // 2 - 1:-1]))
print(*output, sep='\n')


T = int(input())
for _ in range(T):
	n = int(input())
	n1 = n // 2
	b = 2 ** n1 - 2
	print(2 * b + 2)


n = int(input())
lst = []
for i in range(n):
	x = int(input())
	if x == 2:
		lst.append(2)
	else:
		z = 2 ** x
		for i in range(1, x // 2):
			z += 2 ** i
		m = 0
		for p in range(x // 2, x):
			m += 2 ** p
		lst.append(z - m)
for y in lst:
	print(y)


for _ in range(int(input())):
	n = int(input())
	i = n // 2 - 1
	num1 = 0
	num2 = 0
	k = n // 2
	while i >= 1:
		num1 += 1 << i
		i -= 1
	num1 += 1 << n
	while k < n:
		num2 += 1 << k
		k += 1
	print(abs(num1 - num2))


for i in range(int(input())):
	a = int(input())
	l = [2 ** x for x in range(1, a + 1)]
	left = l[-1]
	right = 0
	for j in range(0, a // 2 - 1):
		left += l[j]
	for j in range(a // 2 - 1, a - 1):
		right += l[j]
	print(abs(left - right))


import math
size = int(input())
for i in range(size):
	sum = 0
	sum1 = 0
	num = int(input())
	sum = math.pow(2, num)
	for j in range(1, num // 2):
		sum = sum + math.pow(2, j)
	for j in range(num // 2, num):
		sum1 = sum1 + math.pow(2, j)
	print(int(sum) - int(sum1))


import sys
import math

def solve():
	pass

def main():
	input = sys.stdin.readline
	t = int(input())
	while t > 0:
		t -= 1
		n = int(input())
		p1 = 0
		for i in range(1, n + 1):
			p1 += 1 << i
		elemnum = n // 2
		elem = 0
		i = n - 1
		p2 = 0
		while elem < elemnum:
			p2 += 1 << i
			elem += 1
			i -= 1
		p1 -= p2
		print(abs(p1 - p2))
main()


for _ in range(int(input())):
	n = int(input())
	(fir, sec) = (0, 0)
	tmp = 2
	for i in range(n):
		if i < n // 2 - 1 or i == n - 1:
			fir += tmp
		else:
			sec += tmp
		tmp *= 2
	print(fir - sec)


import math

def BuubleSort(a):
	(sum1, sum2) = (0, 0)
	if a == 2:
		return 2
	else:
		d = a // 2
		for i in range(1, d):
			sum1 += 2 ** i
		sum1 += 2 ** a
		for i in range(d, a):
			sum2 += 2 ** i
		return abs(sum1 - sum2)

def main():
	n = int(input())
	for _ in range(n):
		a = int(input())
		ans = BuubleSort(a)
		print(ans)
main()


t = int(input())
for j in range(t):
	n = int(input())
	lst = list((2 ** i for i in range(1, n + 1)))
	Div = n // 2
	Sum1 = sum(lst[:Div - 1]) + lst[-1]
	Sum2 = sum(lst[Div - 1:-1])
	print(abs(Sum1 - Sum2))


t = int(input())
numbers = []
for i in range(t):
	index = int(1)
	n = int(input())
	sumF = 2 ** n
	sumS = int(0)
	for j in range(1, n):
		if index >= n / 2:
			sumS += 2 ** j
		else:
			sumF += 2 ** j
		index += 1
	print(sumF - sumS)


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	for i in range(1, n + 1):
		a.append(2 ** i)
	m = n // 2
	x = a[m - 1:m - 1 + n // 2]
	y = sum(x)
	z = sum(a) - y
	print(abs(y - z))


t = int(input())
for x in range(t):
	n = input()
	n = int(n)
	p = 2 ** n
	q = 0
	for i in range(1, int(n / 2)):
		a = 2 ** i
		p += a
	for l in range(int(n / 2), n):
		b = 2 ** l
		q += b
	ans = p - q
	print(ans)


cases = int(input())
while cases:
	cases -= 1
	n = int(input())
	ls = [2 ** x for x in range(1, n + 1)]
	(a, b) = (0, 0)
	a = ls[n - 1]
	for i in range(n // 2 - 1):
		a += ls[i]
	for i in range(n // 2 - 1, n - 1):
		b += ls[i]
	print(abs(a - b))


import math
n = int(input())
for i in range(n):
	m = int(input())
	k = 2 * (2 ** (m // 2 - 1) - 1)
	p = k + 2 ** m
	q = 2 * (2 ** (m - 1) - 1) - k
	print(abs(p - q))


for _ in range(int(input())):
	n = int(input())
	(left, right) = (0, 0)
	cur = 2
	for i in range(1, n // 2):
		left += cur
		cur *= 2
	for i in range(n // 2, n):
		right += cur
		cur *= 2
	left += cur
	print(left - right)


t = int(input())
while t > 0:
	n = int(input())
	p1 = 0
	p2 = 0
	ct = 0
	for i in range(n, 0, -1):
		a = 2 ** i
		if p1 < p2 and ct < n // 2:
			p1 += a
			ct += 1
		else:
			p2 += a
	print(abs(p1 - p2))
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	k = 0
	x = 0
	while k != n / 2 - 1:
		k += 1
		x += 2 ** k
	x += 2 ** n
	while k != n - 1:
		k += 1
		x -= 2 ** k
	print(x)


def power(x, y):
	res = 1
	x = x
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x
		y = y >> 1
		x = x * x
	return res
I = int(input())
for i in range(I):
	try:
		N = int(input())
		print(power(2, N) + (power(2, int(N / 2)) - 2) - (power(2, N) - 2 - (power(2, int(N / 2)) - 2)))
	except EOFError:
		break


from sys import stdin
input = stdin.readline
import bisect
import math
for xoxo in range(1):
	a = [2]
	for i in range(32):
		a.append(a[-1] * 2)
	for _ in range(int(input())):
		n = int(input())
		b = a[:n]
		s = sum(b[:n // 2 - 1]) + b[-1]
		print(abs(sum(b) - 2 * s))


t = int(input())
for i in range(t):
	coins = int(input())
	val = []
	diff = []
	for j in range(1, coins + 1):
		val.append(2 ** j)
	for j in range(1, coins):
		h1 = val[0:int(coins / 2)]
		h2 = val[int(coins / 2):int(coins + 1)]
		a = sum(h1)
		b = sum(h2)
		diff.append(a)
		diff.append(b)
		(val[j - 1], val[j]) = (val[j], val[j - 1])
	print(min(diff))


def minDiff(n):
	return 2 ** (n // 2 + 1) - 2
t = int(input())
for _ in range(t):
	n = int(input())
	print(minDiff(n))


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
for _ in range(int(input())):
	n = int(input())
	(a, b) = (2 ** n, 0)
	n2 = int(n / 2)
	for i in range(1, n2):
		a += 2 ** i
	for i in range(n2, n):
		b += 2 ** i
	print(a - b)


t = int(input())
for _ in range(t):
	n = int(input())
	pot = [2 ** x for x in range(1, n + 1)]
	a = pot[:len(pot) // 2]
	b = pot[len(pot) // 2:]
	print(sum(pot) - sum(b))


def solve(n):
	c = n // 2 + 1
	return 2 ** c - 2

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		answer = solve(n)
		print(answer)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	for i in range(1, n + 1, 1):
		arr.append(2 ** i)
	a = arr[-1]
	arr[-1] = 0
	for i in range(0, n // 2 - 1, 1):
		a = a + arr[i]
		arr[i] = 0
	print(abs(a - sum(arr)))


s = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184]
for _ in range(int(input())):
	k = 0
	p = int(input())
	if p % 2 != 0:
		b = (p + 1) / 2
	else:
		b = p / 2
	for i in range(p):
		k += s[i]
	for i in range(0, int(b)):
		k -= 2 * s[i + int(b) - 1]
	if k < 0:
		k *= -1
	print(k)


n = int(input())
t = []
for i in range(n):
	num = int(input())
	t.append(num)
for l in range(n):
	sum1 = 0
	aa = 0
	for x in range(1, int(t[l] / 2)):
		aa = aa + +2 ** x
	aa = aa + 2 ** int(t[l])
	for o in range(int(t[l] / 2), t[l]):
		sum1 = sum1 + 2 ** o
	print(abs(aa - sum1))


cw = []
for i in range(1, 31):
	cw.append(2 ** i)
for i in range(int(input())):
	n = int(input())
	p1 = cw[n - 1] + sum(cw[0:int(n / 2) - 1])
	p2 = sum(cw[int(n / 2) - 1:n - 1])
	print(p1 - p2)


t = int(input())
for i in range(t):
	coins = int(input())
	ans = 2 ** coins
	k = 1
	while k + 1 <= coins / 2:
		ans += 2 ** k
		k += 1
	k = coins // 2
	while k < coins:
		ans -= 2 ** k
		k += 1
	print(abs(ans))


t = int(input())
for _ in range(0, t):
	n = int(input())
	a = 1
	b = n - 2
	big = pow(2, n)
	small = pow(2, n - 1)
	while b > a:
		big += pow(2, a)
		small += pow(2, b)
		a = a + 1
		b = b - 1
	print(abs(big - small))


import math
for _ in range(int(input())):
	i = int(input())
	if i == 2:
		print(2)
	else:
		j = 2 ** i
		k = (i - 2) // 2
		for x in range(1, k + 1):
			j = j + 2 ** x
		sum = 2 * (2 ** i - 1)
		defferene = sum - j
		print(int(math.fabs(j - defferene)))


def solve(n):
	s = 0
	for i in range(1, n + 1):
		s += 2 ** i
	for i in range(n // 2, n):
		s -= 2 ** (i + 1)
	return s
tests = int(input())
for test in range(tests):
	n = int(input())
	print(solve(n))


for _ in range(int(input())):
	n = int(input())
	l = [2 ** i for i in range(1, n + 1)]
	s = l[-1]
	s += sum(l[:n // 2 - 1])
	a = sum(l[n // 2 - 1:-1])
	print(abs(s - a))


from sys import stdin, stdout
from math import gcd, sqrt, floor, ceil
input = stdin.readline

def list_inp(x):
	return list(map(x, input().split()))

def map_inp(x):
	return map(x, input().split())

def lcm(a, b):
	return a * b / gcd(a, b)
t = int(input())
for _ in range(t):
	n = int(input())
	sum1 = 1 << n
	sum2 = 0
	q = n // 2
	for i in range(1, q):
		sum1 += 1 << i
	for i in range(q, n):
		sum2 += 1 << i
	print(sum1 - sum2)


for _ in range(int(input())):
	n = int(input())
	ans = 0
	for i in range(1, n + 1):
		k = pow(2, i)
		if i == n or i < n // 2:
			ans += k
		else:
			ans -= k
	print(ans)


pows = [2 ** k for k in range(32)]
T = int(input().strip())
for t in range(T):
	L = int(input().strip())
	n = L // 2
	left = pows[L] + sum(pows[1:n])
	right = sum(pows[n:L])
	print(left - right)


from sys import stdin, stdout
import math
import heapq
t = 1

def aint():
	return int(input().strip())

def lint():
	return list(map(int, input().split()))

def fint():
	return list(map(int, stdin.readline().split()))

def main():
	n = aint()
	(a, b) = (0, 0)
	for i in range(1, n // 2):
		a += 1 << i
	a += 1 << n
	for i in range(n // 2, n):
		b += 1 << i
	print(a - b)
	return
t = int(input())
for i in range(t):
	main()


for _ in range(int(input())):
	N = int(input())
	print(pow(2, N) + 2 * (pow(2, N // 2 - 1) - 1) - pow(2, N // 2) * (pow(2, N // 2) - 1))


for _ in range(int(input())):
	n = int(input())
	i = 1
	sum_a = 2 ** n
	sum_b = 0
	while i <= n // 2 - 1:
		sum_b += 2 ** (n - i)
		sum_a += 2 ** i
		i += 1
	sum_b += 2 ** (n // 2)
	print(abs(sum_a - sum_b))


T = int(input())
for t in range(T):
	n = int(input())
	coins = list()
	acoin = list()
	bcoin = list()
	for x in range(1, n + 1):
		coins.append(2 ** x)
	acoin.append(coins[-1])
	i = 0
	tot = n // 2
	while len(acoin) < tot:
		acoin.append(coins[i])
		i += 1
	while len(bcoin) < tot:
		bcoin.append(coins[i])
		i += 1
	print(abs(sum(acoin) - sum(bcoin)))


Test = int(input())
while Test > 0:
	n = int(input())
	a = []
	for i in range(1, n + 1):
		a.append(2 ** i)
	a.insert(0, 0)
	Sum1 = 0
	Sum2 = 0
	for i in range(1, n // 2):
		Sum1 += a[i]
	Sum1 += a[n]
	for i in range(n // 2, n):
		Sum2 += a[i]
	print(abs(Sum1 - Sum2))
	Test -= 1


t = int(input())
for i in range(t):
	k = int(input())
	s = 2
	for j in range(2, k, 2):
		s *= 2
		s += 2
	print(s)


def findMin(n):
	count = 0
	for i in range(1, n // 2):
		count += 2 ** i
	for i in range(n // 2, n - 1):
		count -= 2 ** i
	count += 2 ** n - 2 ** (n - 1)
	return count
t = int(input())
for i in range(t):
	n = int(input())
	result = findMin(n)
	print(result)


for i in range(int(input())):
	n = int(input())
	k = 2
	z = 4
	for j in range(1, n // 2):
		k += z
		z *= 2
	print(k)


a = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824]
t = int(input())
for i in range(t):
	n = int(input())
	ans = 0
	for j in range(1, n + 1):
		if j == n:
			ans += a[j]
		elif j < n // 2:
			ans += a[j]
		else:
			ans -= a[j]
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	l = [2 ** i for i in range(1, n + 1)]
	d = l[-1] + sum(l[:n // 2 - 1])
	print(2 * d - sum(l))


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print(2)
	else:
		l = []
		for j in range(1, n + 1):
			l.append(2 ** j)
		x = l[0:n // 2 - 1]
		y = l[n // 2 - 1:n - 1]
		s1 = sum(x) + l[n - 1]
		s2 = sum(y)
		print(abs(s1 - s2))


t = int(input())
h = []
for i in range(t):
	p = int(input())
	h.append(p)

def bal_ance(n):
	p = []
	for i in range(1, n + 1):
		f = 2 ** i
		p.append(f)
	sum_left = 0
	sum_right = 0
	i = -1
	count_l = 1
	count_r = 1
	while count_l <= n / 2:
		sum_left = sum_left + p[i]
		i += 1
		count_l += 1
	j = int(n // 2 - 1)
	while count_r <= n / 2:
		sum_right = sum_right + p[j]
		j += 1
		count_r += 1
	return abs(sum_right - sum_left)
for i in range(t):
	g = bal_ance(h[i])
	print(g)


def output(x, A, B):
	print('Case #{0}: {1} {2}'.format(x, A, B))

def solve(time):
	total = int(input())
	need = total // 2
	sumA = 2 ** total
	sumB = 0
	total -= 1
	for i in range(1, total + 1):
		if i <= need - 1:
			sumA += 2 ** i
		else:
			sumB += 2 ** i
	print(abs(sumA - sumB))
nums = int(input())
for _ in range(1, nums + 1):
	solve(_)


t = int(input())
for xx in range(t):
	n = int(input())
	l = [2 ** x for x in range(1, n + 1)]
	l1 = []
	l2 = []
	l1.append(max(l))
	for i in range(0, int(n / 2) - 1):
		l1.append(l[i])
	for i in range(int(n / 2) - 1, n - 1):
		l2.append(l[i])
	print(abs(sum(l1) - sum(l2)))


for _ in range(int(input())):
	n = int(input())
	L = [2 ** (i + 1) for i in range(n)]
	w = [0, 0]
	L = [2 ** (i + 1) for i in range(n)]
	(L[n // 2 - 1], L[-1]) = (L[-1], L[n // 2 - 1])
	for i in range(n):
		if i < n // 2:
			w[0] += L[i]
		else:
			w[1] += L[i]
	print(w[0] - w[1])


for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(2)
	else:
		s = 2 ** n
		k = 1
		for i in range(n // 2 - 1):
			s += 2 ** k
			k += 1
		d = 0
		for i in range(n // 2 - 1, n - 1):
			d += 2 ** k
			k += 1
		print(abs(s - d))


t = int(input())
for i in range(t):
	n = int(input())
	l = [1 << i for i in range(1, n + 1)]
	k = n // 2
	s = l[n - 1]
	i = 0
	while k > 1:
		s += l[i]
		i += 1
		k -= 1
	print(abs(sum(l) - 2 * s))


def result(x):
	if x == 2:
		return 2
	return 2 * result(x - 2) + 2
t = int(input())
for _ in range(t):
	print(result(int(input())))


t = int(input())
arr = []
for i in range(t):
	arr.append(int(input()))
for n in arr:
	sum1 = 0
	sum2 = 0
	sum1 = 2 ** n
	for i in range(1, int(n / 2)):
		sum1 += 2 ** i
	for i in range(int(n / 2), n):
		sum2 += 2 ** i
	print(abs(sum1 - sum2))


for test_case in range(int(input())):
	num = int(input())
	a = []
	b = []
	for x in range(1, num + 1):
		if x % 2 != 0:
			a.append(2 ** x)
		else:
			b.append(2 ** x)
	biggest_a = a.pop(-1)
	biggest_b = b.pop(-1)
	while True:
		try:
			if min(a) < max(b):
				temp_a = min(a)
				a.remove(min(a))
				temp_b = max(b)
				b.remove(max(b))
				a.append(temp_b)
				b.append(temp_a)
			else:
				break
		except ValueError:
			break
	a.append(biggest_a)
	b.append(biggest_b)
	print(abs(sum(a) - sum(b)))


for _ in range(int(input())):
	n = int(input())
	power = [2 ** y for y in range(1, n + 1)]
	(a, b) = (power[:len(power) // 2], power[len(power) // 2:])
	print(abs(sum(power) - sum(b)))


def func(n):
	for i in range(n):
		k = int(input())
		l = [2 ** x for x in range(1, k + 1)]
		sum_1 = sum(l[:k // 2 - 1]) + l.pop()
		sum_2 = sum(l[k // 2 - 1:])
		print(abs(sum_1 - sum_2))
n = int(input())
func(n)


for _ in range(int(input())):
	k = int(input())
	print(2 ** (k // 2 + 1) - 2)


t = int(input())
nCoins = []
for i in range(t):
	num = int(input())
	nCoins.append(num)
for i in range(len(nCoins)):
	weights = []
	for j in range(nCoins[i]):
		weights.append(2 ** (j + 1))
	pile1 = 0
	pile2 = 0
	while len(weights) > 0:
		if pile1 <= pile2:
			pile1 += max(weights)
			weights.remove(max(weights))
			if pile1 <= pile2:
				pile2 += min(weights)
				weights.remove(min(weights))
				continue
			pile2 += max(weights)
			weights.remove(max(weights))
		else:
			pile2 += max(weights)
			weights.remove(max(weights))
			if pile2 < pile1:
				pile1 += min(weights)
				weights.remove(min(weights))
				continue
			pile1 += max(weights)
			weights.remove(max(weights))
	diff = abs(pile1 - pile2)
	print(diff)


t = int(input())
for i in range(t):
	n = int(input())
	sum_n = 2 * (2 ** n - 1)
	nth = 2 * 2 ** (n - 1)
	mid = n // 2 - 1
	sum_mid = 2 * (2 ** mid - 1) + nth
	print(abs(sum_n - sum_mid - sum_mid))


A = []
for i in range(1, 31):
	A.append(2 ** i)

def main():
	n = int(input())
	B = A[:n]
	x = 0
	x += B[-1]
	x += sum(B[:n // 2 - 1])
	print(abs(x - sum(B[n // 2 - 1:-1])))
for _ in range(int(input())):
	main()


for t in range(int(input())):
	nc = int(input())
	wheiths = []
	for x in range(1, nc + 1):
		numero = pow(2, x)
		wheiths.append(numero)
	ga = 0
	gb = 0
	cont_a = 0
	cont_b = 0
	for x in list(reversed(wheiths)):
		if cont_a < nc / 2 and cont_b < nc / 2:
			if ga == gb:
				ga += x
				cont_a += 1
			elif ga > gb:
				gb += x
				cont_b += 1
			elif gb > ga:
				ga += x
				cont_a += 1
		elif cont_a >= nc / 2:
			gb += x
		else:
			ga += x
	print(abs(ga - gb))


import sys

def read_int():
	return int(sys.stdin.readline().strip())

def solve(n):
	a = 1 << n
	cnt_a = n // 2
	a += 2 * ((1 << cnt_a - 1) - 1)
	b = (1 << n + 1) - 2 - a
	return a - b

def main():
	for _ in range(read_int()):
		print(solve(read_int()))
main()


t = int(input())
for i in range(t):
	n = int(input())
	wts = [2 ** k for k in range(1, n + 1)]
	ltr = []
	x = int(n / 2 - 1)
	y = n - 1
	for a in range(x, y):
		pp = wts[a]
		ltr.append(pp)
	l = len(ltr)
	for aa in range(l):
		if ltr[aa] in wts:
			wts.remove(ltr[aa])
	suml = 0
	sumh = 0
	for i1 in wts:
		suml += i1
	for i2 in ltr:
		sumh += i2
	res = suml - sumh
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = 0
	for i in range(1, n // 2):
		arr += 2 ** i
	arr += 2 ** n
	x = 2 ** (n + 1) - arr - 2
	print(abs(arr - x))


t = int(input())
while t:
	n = int(input())
	m = n // 2
	if n > 2:
		lp = 2 * (2 ** (m - 1) - 1) + 2 ** n
		fp = 2 * (2 ** n - 1)
		ans = 2 * lp - fp
		print(ans)
	else:
		print(2)
	t = t - 1


def solver(n):
	(s1, s2) = (1 << n, 0)
	for i in range(1, n // 2):
		s1 += 1 << i
	for i in range(n // 2, n):
		s2 += 1 << i
	return abs(s2 - s1)
for _ in range(int(input())):
	m = int(input())
	print(solver(m))


l = [0]
for i in range(1, 31):
	l.append(l[i - 1] * 2 + 2)
for _ in range(int(input())):
	n = int(input())
	print(l[n // 2])


def coin():
	case = int(input())
	for _ in range(case):
		pile1 = 0
		pile2 = 0
		n = int(input())
		N = n
		nbrCoin1 = 0
		nbrCoin2 = 0
		if n == 0:
			print('0')
		else:
			pile1 += 2 ** n
			nbrCoin1 += 1
			n -= 1
			while pile2 + 2 ** n < pile1 and nbrCoin2 < N // 2:
				pile2 += 2 ** n
				nbrCoin2 += 1
				n -= 1
			for i in range(1, n + 1):
				pile1 += 2 ** i
			print(abs(pile1 - pile2))
coin()


cases = int(input())
for _ in range(cases):
	n = int(input())
	val = 2 ** n
	for i in range(1, n // 2):
		val += 2 ** i
	for i in range(n // 2, n):
		val -= 2 ** i
	print(val)


t = int(input())
for _ in range(t):
	an = 0
	ans = 0
	n = int(input())
	for i in range(1, n + 1):
		ans += 2 ** i
	an += 2 ** n
	z = n // 2 - 1
	for j in range(1, z + 1):
		an += 2 ** j
	e = ans - an
	print(abs(e - an))


T = int(input())
for _ in range(1, T + 1):
	n = int(input())
	as1 = 2 ** (n + 1) - 2
	as2 = 2 ** (n // 2) - 2 + 2 ** n
	print(2 * as2 - as1)


t = int(input())
for _ in range(t):
	n = int(input())
	k = n // 2
	ans = 2 ** (k + 1) - 2
	print(ans)


def min_balance(n):
	power = list(range(1, n + 1))
	i = int(n / 2) - 1
	pow_1 = power[:i]
	pow_1.append(n)
	pow_2 = power[i:n - 1]
	pow_1 = sum([2 ** i for i in pow_1])
	pow_2 = sum([2 ** i for i in pow_2])
	return pow_1 - pow_2
n = int(input())
power = []
for i in range(n):
	temp = min_balance(int(input()))
	power.append(temp)
for i in power:
	print(i)


t = input()
for _ in range(int(t)):
	n = int(input())
	s1 = int(pow(2, n) + pow(2, n // 2) - 2)
	s2 = pow(2, n + 1) - 2 - s1
	print(abs(s1 - s2))


from sys import stdin
a = int(stdin.readline())
for b in range(0, a):
	c = int(stdin.readline())
	print(int(2 ** (c / 2 + 1) - 2))


t = int(input())
for _ in range(t):
	n = int(input())
	x = [0] * n
	x[0] = 2
	for i in range(1, n):
		x[i] = x[i - 1] * 2
	a = x[n - 1]
	ind = int(n / 2 - 1)
	a += sum(x[0:ind])
	b = sum(x[ind:n - 1])
	print(abs(a - b))


t = int(input())
while t:
	n = int(input())
	k1 = k2 = 0
	for i in range(1, n):
		if i < n // 2:
			k1 += 2 ** i
		else:
			k2 += 2 ** i
	print(abs(k1 - k2 + 2 ** n))
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	b = []
	(sum, sum1) = (0, 0)
	for i in range(1, n + 1):
		b.append(2 ** i)
	for i in range(n // 2 - 1):
		sum += b[i]
	sum += b[n - 1]
	for i in range(n // 2 - 1, n - 1):
		sum1 += b[i]
	print(sum - sum1)


import math

def s():
	n = int(input())
	pile1 = 0
	pile2 = 0
	for i in range(1, n - 2 + 1):
		if i <= int((n - 2) / 2):
			pile1 += math.pow(2, i)
		else:
			pile2 += math.pow(2, i)
	pile1 += math.pow(2, n)
	pile2 += math.pow(2, n - 1)
	print(int(abs(pile1 - pile2)))
t = int(input())
for i in range(t):
	s()


t = int(input())
while t:
	t = t - 1
	n = int(input())
	d = 0
	c = 2
	for i in range(0, n // 2):
		d += c
		c *= 2
	print(d)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	l = []
	for i in range(2, n + 1):
		if prime[i]:
			l.append(i)
	return l

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, ll, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		if ll[mid] == val:
			return ll[mid]
		elif ll[mid] < val:
			ans = ll[mid]
			return binary(mid + 1, r, ll, val, ans)
		else:
			return binary(l, mid - 1, ll, val, ans)

def check(n):
	v = 1
	while n != 0:
		if n % 10 == 0 or n % 10 == 1:
			n = n // 10
		else:
			v = 0
			break
	return v
t = int(input())
for i in range(t):
	n = int(input())
	l1 = []
	l2 = []
	if n == 2:
		print(2)
	else:
		l1 = []
		l2 = []
		for j in range(1, n + 1):
			if j < n // 2:
				l1.append(2 ** j)
			elif j == n:
				l1.append(2 ** j)
			else:
				l2.append(2 ** j)
		print(abs(sum(l1) - sum(l2)))


import sys
input = sys.stdin.readline
read = lambda : map(int, input().split())
read_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(councils, a, k):
	summ = 0
	for x in a:
		summ += min(x, councils)
	return summ // councils >= k
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
import bisect as bis
import random
import sys

def contains(s):
	s = list(s)
	c = 0
	for i in range(len(s) - 6):
		if ''.join(s[i:i + 7]) == 'abacaba':
			c += 1
	return c

def process(s):
	ans = ''
	for x in s:
		if x == '?':
			ans = ans + 'd'
		else:
			ans = ans + x
	return ans

def solve():
	n = int(input())
	s = 2 * (2 ** n - 1)
	rs = 0
	for i in range(1, n // 2):
		rs += 2 ** i
	rs += 2 ** n
	ls = s - rs
	print(rs - ls)
for _ in range(int(input())):
	solve()


n = int(input())
for i in range(n):
	p = int(input())
	a = [2 ** j for j in range(1, p + 1)]
	a = [a[-1]] + a[:-1]
	print(abs(sum(a[:p // 2]) - sum(a[p // 2:])))


t = int(input())
for i in range(t):
	n = int(input())
	c = n // 2
	lst1 = [2 ** i for i in range(c, 2 * c)]
	lst2 = [2 ** i for i in range(1, c)]
	lst2 += [2 ** n]
	print(sum(lst2) - sum(lst1))


def split_coins(n):
	return 2 + 2 * (2 ** (n // 2) - 2)
number_of_tests = int(input())
for _ in range(number_of_tests):
	n = int(input())
	result = split_coins(n)
	print(result)


t = int(input())
n = [int(input()) for _ in range(t)]
for ni in n:
	if ni == 2:
		print(2)
	elif ni == 4:
		print(6)
	else:
		k = int(ni * 0.5) - 1
		a = 2 ** (k + 1) - 2 + 2 ** ni
		b = 2 ** (ni + 1) - 2 - a
		print(abs(a - b))


n = int(input())
while n > 0:
	n = n - 1
	m = int(input())
	(sum1, sum2) = (0, 0)
	for j in range(1, m // 2):
		sum1 += 2 ** j
	sum1 += 2 ** m
	for k in range(m // 2, m):
		sum2 += 2 ** k
	print(sum1 - sum2)


s = input()
while True:
	try:
		s = int(input())
		t = [int(pow(2, i)) for i in range(1, s + 1)]
		if len(t) == 2:
			print(abs(t[0] - t[1]))
		else:
			a = sum(t[0:len(t) // 2 - 1]) + t[-1]
			b = sum(t[len(t) // 2 - 1:-1])
			print(abs(a - b))
	except:
		break


for _ in range(int(input())):
	even = 0
	odd = 0
	b = int(input())
	n = b
	i = 1
	odd = odd + pow(2, b)
	while i <= n // 2 - 1:
		odd = odd + pow(2, i)
		i += 1
	while i < n:
		even = even + pow(2, i)
		i += 1
	print(max(even, odd) - min(even, odd))


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		s = 0
		a = 0
		b = 0
		for i in range(1, N + 1):
			s += 2 ** i
			if i <= N // 2 - 1 or i == N:
				b += 2 ** i
		print(abs(abs(s - b) - b))
main()


n = int(input())
L = []
for i in range(1, 31):
	L.append(2 ** i)
for i in range(0, n):
	o = int(input())
	if 1:
		A = L[0:o]
		B = o // 2 - 1
		D = 0
		for j in range(0, B):
			D += A[j]
		E = 0
		for j in range(B, len(A) - 1):
			E += A[j]
		D += A[len(A) - 1]
		print(abs(D - E))


t = int(input())
for z in range(t):
	n = int(input())
	last = 2 ** n
	sec_large = 2 ** (n - 1)
	no_large = int(n // 2) - 1
	large_sum = 2 * (2 ** no_large - 1) + last
	a = 2 ** (no_large + 1)
	power = int(n // 2)
	small_sum = a * (2 ** power - 1)
	print(large_sum - small_sum)


for _ in range(int(input())):
	n = int(input())
	(b, a) = (0, 0)
	b = b + 2 ** n
	for i in range(1, n):
		if i < n // 2:
			b = b + 2 ** i
		if i >= n // 2:
			a = a + 2 ** i
	minm_diff = b - a
	print(minm_diff)


for _ in range(int(input())):
	N = int(input())
	if N == 2:
		print(2)
	else:
		Bada = 0
		for i in range(1, int(N // 2)):
			Bada += 2 ** i
		Bada += 2 ** N
		Total = 2 ** (N + 1) - 2
		Small = Total - Bada
		print(abs(Small - Bada))


t = int(input())
for i in range(t):
	n = int(input())
	l = [pow(2, x) for x in range(1, n + 1)]
	r = []
	for j in range(n // 2 - 1):
		r.append(l[j])
	r.append(l[-1])
	z = []
	for j in l:
		if j not in r:
			z.append(j)
	print(abs(sum(r) - sum(z)))


a = int(input())
for i in range(a):
	b = int(input())
	print(2 ** (b // 2 + 1) - 2)


for _ in range(int(input())):
	n = int(input())
	s1 = 0
	s2 = 0
	m = n // 2
	for i in range(1, m):
		s1 = s1 + pow(2, i)
	for i in range(m, n):
		s2 = s2 + pow(2, i)
	s1 = s1 + pow(2, n)
	print(abs(s1 - s2))


def find_min(n):
	(a, b) = (2 ** n, 0)
	for i in range(1, n // 2):
		a += 2 ** i
	for j in range(n // 2, n):
		b += 2 ** j
	return abs(a - b)
for _ in range(int(input())):
	n = int(input())
	print(find_min(n))


pot = [1] * 40
for i in range(1, 40):
	pot[i] = 2 * pot[i - 1]
q = int(input())
for riwe in range(q):
	n = int(input())
	wyn = pot[n]
	for i in range(n // 2):
		j = n - 1 - i
		wyn -= pot[j]
	for i in range(1, n // 2):
		wyn += pot[i]
	print(wyn)


t = int(input())
while t:
	n = int(input())
	if n == 2:
		print(2)
	else:
		arr = [2 ** i for i in range(1, n + 1)]
		till = n // 2
		onehalf = 0
		for i in range(len(arr) - 2, 0, -1):
			if till:
				onehalf = onehalf + arr[i]
				arr[i] = -1
				till = till - 1
		secondhalf = 0
		for i in range(len(arr)):
			if arr[i] == -1:
				continue
			else:
				secondhalf = secondhalf + arr[i]
		print(abs(onehalf - secondhalf))
	t = t - 1


arr = [0]
for i in range(1, 32 + 1):
	arr.append(2 ** i)
for t in range(int(input())):
	n = int(input())
	s1 = 0
	for i in range(n - 1, n - 1 - n // 2, -1):
		s1 += arr[i]
	s2 = arr[n]
	for i in range(1, n // 2):
		s2 += arr[i]
	print(s2 - s1)


import math
l = [1]
b = 2
for i in range(1, 31):
	l.append(int(math.pow(2, i)))
for _ in range(int(input())):
	n = int(input())
	b = n // 2
	l1 = []
	l2 = []
	c = sum(l[b:n])
	d = sum(l[1:b]) + l[n]
	print(abs(c - d))


t = int(input())
for _ in range(t):
	a = int(input())
	arr = []
	arr.append(2)
	(sum1, sum2) = (0, 0)
	if a >= 4:
		for i in range(1, a):
			arr.append(arr[i - 1] * 2)
			if i <= a // 2 - 2:
				sum1 += arr[i]
			elif i > a // 2 - 2 and i < a - 1:
				sum2 += arr[i]
		sum1 += arr[-1] + arr[0]
	else:
		(sum1, sum2) = (4, 2)
	print(abs(sum1 - sum2))


def func(x):
	return 2 ** (x // 2 + 1) - 2

def main():
	t = int(input())
	for i in map(func, [int(input()) for i in range(t)]):
		print(i)
main()


t = int(input())
h = 0
while h < t:
	n = int(input())
	array = []
	for i in range(n):
		x = 2 ** (i + 1)
		array.append(x)
	array = array[::-1]
	j = 0
	med = n // 2
	a = 0
	b = 0
	(aa, bb) = (0, 0)
	while j < n:
		if j == 0:
			aa += array[j]
			a += 1
		elif aa > bb:
			if b < n // 2:
				bb += array[j]
				b += 1
			else:
				aa += array[j]
		elif a < n // 2:
			aa += array[j]
			a += 1
		else:
			bb += array[j]
		j += 1
	cc = aa - bb
	if cc < 0:
		cc = cc * -1
	print(cc)
	h += 1


t = int(input())
while t > 0:
	n = int(input())
	s1 = 2 ** n
	for i in range(1, n // 2):
		s1 += pow(2, i)
	s2 = 0
	for i in range(n // 2, n):
		s2 += pow(2, i)
	print(s1 - s2)
	t -= 1


import sys, random
from bisect import bisect_left, bisect_right
input = sys.stdin.readline

def main():
	inf = 10 ** 20
	t = int(input())
	for _ in range(1, t + 1):
		n = int(input())
		a = 1 << n
		b = 0
		for i in range(1, n // 2):
			a += 1 << i
		for i in range(n // 2, n):
			b += 1 << i
		print(abs(a - b))
main()


def s(b1, N):
	return b1 * (2 ** N - 1)
t = int(input())
for q in range(t):
	n = int(input())
	sum1 = 2 ** n + s(2, n // 2 - 1)
	sum2 = s(2 ** (n // 2), n // 2)
	print(abs(sum1 - sum2))


T = int(input())
for tc in range(T):
	n = int(input())
	k = n // 2
	a = 2 ** k * (2 ** k - 1)
	b = 2 ** n + 2 * (2 ** (k - 1) - 1)
	print(b - a)


t = int(input())
for _ in range(t):
	n = int(input())
	weight = [2 ** i for i in range(1, n + 1)]
	if n == 2:
		print('2')
	else:
		r = n // 2
		left = sum(weight[0:r - 1]) + weight[n - 1]
		right = sum(weight[r - 1:n - 1])
		su_m = abs(left - right)
		print(su_m)


n = int(input())
for _ in range(n):
	a = int(input())
	count = 0
	for i in range(1, a // 2 + 1):
		count += 2 ** i
	print(count)


from sys import stdin
cin = lambda : stdin.readline()
mi = lambda : map(int, cin().split())
li = lambda : list(mi())
ri = lambda : int(cin())
for _ in range(ri()):
	n = ri()
	a = pow(2, n // 2) - 2
	pn = pow(2, n)
	b = pn - 2 - a
	a += pn
	print(abs(a - b))


t = int(input())
for z in range(t):
	n = int(input())
	if n != 2:
		s1 = 2 * ((1 << int(n / 2) - 1) - 1)
		s2 = 2 * ((1 << n - 1) - 1)
		s3 = s2 - s1
		s1 = s1 + (1 << n)
	else:
		s1 = 2
		s2 = 4
		s3 = 4
	print(abs(s1 - s3))


import sys
import collections
readline = sys.stdin.buffer.readline

def solve(n):
	h = n // 2
	bs = [2 ** i for i in range(1, n + 1)]
	a = sum(bs[:h - 1]) + bs[-1]
	b = sum(bs) - a
	return abs(a - b)

def main():
	T = int(readline())
	for _ in range(T):
		n = int(readline())
		print(solve(n))
main()


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	f = []
	f.append(l[n - 1])
	for i in range(n // 2 - 1):
		f.append(l[i])
	fs = sum(f)
	ss = sum(l) - fs
	print(abs(fs - ss))


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline().rstrip()
res = ['YES', 'NO']
ans = [2]
x = 4
for _ in range(15):
	ans.append(ans[-1] + x)
	x += x
test_case = ii()
while test_case:
	test_case -= 1
	n = ii()
	print(ans[n // 2 - 1])


n = int(input())
res = []
for i in range(1, 30):
	res.append(2 ** i)
main = []
for i in range(n):
	no = int(input())
	if no == 2:
		main.append(2)
	elif no == 30:
		main.append(65534)
	elif no == 4:
		main.append(6)
	elif no == 6:
		main.append(14)
	elif no == 8:
		main.append(30)
	elif no == 10:
		main.append(62)
	elif no == 12:
		main.append(126)
	elif no == 14:
		main.append(254)
	elif no == 16:
		main.append(510)
	elif no == 18:
		main.append(1022)
	elif no == 20:
		main.append(2046)
	elif no == 22:
		main.append(4094)
	elif no == 24:
		main.append(8190)
	elif no == 26:
		main.append(16382)
	elif no == 28:
		main.append(32766)
for i in main:
	print(i)


for ix in range(int(input())):
	n = int(input())
	p1 = 2 ** n
	p2 = 2 ** (n - 1)
	n -= 2
	nx = 1 + n // 2
	nx = 2 ** nx - 2
	p1 += nx
	n += 1
	p2 += 2 ** n - 2 - nx
	print(abs(p1 - p2))


for _ in range(int(input())):
	n = int(input())
	arr = [1 << i for i in range(1, n + 1)]
	sm1 = 0
	sm2 = 0
	sm = sum(arr)
	sm1 = sum(arr[:n // 2 - 1])
	sm1 += arr[n - 1]
	sm2 = sm - sm1
	print(abs(sm1 - sm2))


num = int(input())
for _ in range(num):
	n = int(input())
	print(str(2 ** (n // 2 + 1) - 2))


for _ in range(int(input())):
	n = int(input())
	mid = n // 2
	a = int(''.join('1' * mid + '0' * mid), 2)
	b = int(''.join('1' + '0' * mid + '1' * (mid - 1)) + '0', 2)
	print(b - a)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = []
	b = []
	for i in range(1, n // 2):
		a.append(2 ** i)
	for i in range(n // 2, n):
		b.append(2 ** i)
	a.append(2 ** n)
	print(sum(a) - sum(b))


t = int(input())
for i in range(t):
	(mx, mn) = (0, 0)
	n = int(input())
	for j in range(n // 2 - 1):
		mx += 2 ** (j + 1)
	mx += 2 ** n
	for j in range(n // 2 - 1, n - 1, 1):
		mn += 2 ** (j + 1)
	print(mx - mn)


import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

def inp():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	n = int(inp())
	a = 2 ** n
	b = 0
	for i in range(1, n // 2):
		a += 2 ** i
	for i in range(n // 2, n):
		b += 2 ** i
	out(abs(a - b))
	nextline()
testcase(int(inp()))


T = int(input())
for t in range(T):
	N = int(input())
	v = []
	for i in range(1, N + 1):
		v.append(2 ** i)
	print(v[-1] + sum(v[0:N // 2 - 1]) - sum(v[N // 2 - 1:-1]))


for _ in range(int(input())):
	a = int(input())
	(z, x) = (2 ** a, 0)
	for i in range(1, a):
		if i < a // 2:
			z += 2 ** i
		else:
			x += 2 ** i
	print(z - x)


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	sm = 0
	for i in range(1, n + 1):
		l.append(2 ** i)
	ns = n // 2 - 2
	for i in range(n - 2, ns, -1):
		sm = sm + l[i]
		l.remove(l[i])
	n = sum(l)
	mode = abs(sm - n)
	print(mode)


t = int(input())
for i in range(t):
	n = int(input())
	l1 = []
	l2 = []
	l1.append(2 ** n)
	num = n - 1
	for i in range(n // 2):
		l2.append(2 ** num)
		num -= 1
	for i in range(1, n // 2):
		l1.append(2 ** i)
	print(abs(sum(l1) - sum(l2)))


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
coins = [2 ** i for i in range(1, 31)]
for _ in range(int(input())):
	n = int(input())
	a = coins[:n]
	aa = a[:n // 2 - 1] + [a[-1]]
	bb = a[n // 2 - 1:-1]
	print(abs(sum(aa) - sum(bb)))


import math
for _ in range(int(input())):
	n = int(input())
	b = 0
	i = n - 1
	a = math.pow(2, n)
	c = n // 2
	while c > 0:
		b += math.pow(2, i)
		i -= 1
		c -= 1
	c = n // 2 - 1
	while c > 0:
		a += math.pow(2, i)
		i -= 1
		c -= 1
	print(int(a - b))


ntest = int(input())
for i in range(ntest):
	n = int(input())
	team1 = team2 = 0
	values = [2 ** i for i in range(1, n + 1)]
	team1 = 2 ** n + sum([int(2 ** i) for i in range(1, int(n / 2))])
	team2 = sum([int(2 ** i) for i in range(int(n / 2), n)])
	total = abs(team1 - team2)
	print(total)


t = int(input())
while t != 0:
	t -= 1
	a = int(input())
	print(abs(2 ** (a // 2 + 1) - 2))


test = int(input())
for i in range(test):
	exp = int(input())
	print(2 ** (exp // 2 + 1) - 2)


t = int(input())
for q in range(t):
	n = int(input())
	a = 0
	b = 0
	acount = 0
	bcount = 0
	if n == 2:
		print(2)
		continue
	elif n == 0:
		print(0)
		continue
	a += 2 ** n
	for x in range(0, n - 1):
		if bcount < n // 2:
			b += 2 ** (n - 1 - x)
			bcount += 1
		else:
			a += 2 ** (n - 1 - x)
			acount += 1
	print(abs(a - b))


for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(2)
	elif n == 4:
		print(6)
	else:
		x = 2 ** n
		y = 0
		for i in range(1, int(n / 2)):
			x += 2 ** i
		for j in range(int(n / 2), n):
			y += 2 ** j
		print(abs(x - y))


test = int(input())
for k in range(test):
	n = int(input())
	a = 2 ** n
	b = 0
	flag = 1
	for i in range(1, int(n / 2)):
		a += 2 ** i
	i = int(n / 2)
	while i < n:
		b += 2 ** i
		i += 1
	print(abs(a - b))


t = int(input())
while t:
	n = int(input())
	a = [2 ** i for i in range(1, n + 1)]
	c = n // 2
	i = n - 2
	count = 0
	b = 0
	while count < c:
		b += a[i]
		i -= 1
		count += 1
	i = 0
	s = 0
	while i < c - 1:
		s += a[i]
		i += 1
	s += a[-1]
	print(abs(b - s))
	t -= 1


def solve(cases):
	numbers = [2 ** i for i in range(1, cases + 1)]
	first = numbers[:cases // 2]
	second = numbers[cases // 2:]
	tmp = first[cases // 2 - 1]
	first[cases // 2 - 1] = second[cases // 2 - 1]
	second[cases // 2 - 1] = tmp
	print(abs(sum(first) - sum(second)))

def main():
	nb_cases = int(input())
	for i in range(nb_cases):
		case = int(input())
		solve(case)
main()


t = int(input())
while t > 0:
	m = []
	sum = 0
	n = int(input())
	for i in range(1, n + 1):
		m.append(pow(2, i))
	for i in range(n // 2):
		sum += m[i]
	print(sum)
	t -= 1


for teat in range(int(input())):
	n = int(input())
	lt = [int(2 ** i) for i in range(1, n + 1)]
	a = 0
	b = 0
	if n <= 2:
		print(lt[1] - lt[0])
	else:
		for i in range(1, n // 2 - 1):
			a += lt[i]
		a = a + lt[0] + lt[n - 1]
		for i in range(n // 2 - 1, n - 1):
			b += lt[i]
		print(abs(a - b))


for j in range(int(input())):
	(l, l1, l2) = ([], [], [])
	n = int(input())
	for i in range(1, n + 1):
		l.append(int(2 ** i))
	m = int(n / 2)
	l1 = l[:m]
	l2 = l[m:]
	x = l1[:m - 1]
	x.append(l2[m - 1])
	y = l2[:m - 1]
	y.append(l1[m - 1])
	s = abs(sum(x) - sum(y))
	print(s)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
for _ in range(ii()):
	n = ii()
	arr = []
	for i in range(n):
		arr.append(2 ** (i + 1))
	for i in range(n // 2 - 1, n - 1):
		arr[i] *= -1
	print(sum(arr))


t = int(input())
powa = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824]
for i in range(t):
	n = int(input())
	p1 = powa[n - 1]
	p2 = 0
	count = 1
	for i in range(n - 1):
		if count < n // 2:
			p1 += powa[i]
			count += 1
		else:
			p2 += powa[i]
	print(abs(p1 - p2))


Q = int(input())
for qq in range(Q):
	n = int(input())
	pile1 = 2 ** n + sum([2 ** i for i in range(1, int(n / 2))])
	pile2 = sum([2 ** i for i in range(int(n / 2), n)])
	print(pile1 - pile2)


t = int(input())
for i in range(t):
	n = int(input())
	a = 0
	k = 0
	l = 1
	for j in range(n // 2 - 1):
		a += pow(2, l)
		l += 1
	for j in range(n // 2):
		a -= pow(2, l)
		l += 1
	print(abs(a + pow(2, n)))


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	ans = []
	l = []
	for i in range(1, 101):
		l.append(2 ** i)
	for _ in range(n):
		x = I()
		i = x - 1
		sm_x = sm_y = 0
		sm_x += l[i]
		i -= 1
		for _ in range(x // 2):
			sm_y += l[i]
			i -= 1
		for _ in range(x // 2 - 1):
			sm_x += l[i]
			i -= 1
		ans.append(abs(sm_x - sm_y))
	for x in ans:
		print(x)
main()


def solve():
	n = int(input())
	print(2 ** (n // 2 + 1) - 2)
for i in range(int(input())):
	solve()


n = int(input())
for i in range(n):
	x = int(input())
	a = []
	b = []
	c = []
	for j in range(x):
		a.append(2 ** (j + 1))
	for j in range(1, x - 1):
		for k in range(j):
			if a[j] > a[k]:
				(a[j], a[k]) = (a[k], a[j])
	for j in range(x // 2):
		b.append(a[j])
	for j in range(x // 2, x):
		c.append(a[j])
	s1 = 0
	s2 = 0
	for j in b:
		s1 = s1 + j
	for j in c:
		s2 = s2 + j
	if s1 > s2:
		print(s1 - s2)
	else:
		print(s2 - s1)


a = int(input())
for i in range(a):
	q = int(input())
	b = pow(2, q)
	total = 0
	for i in range(1, q // 2):
		b += pow(2, i)
	for i in range(1, q + 1):
		total += pow(2, i)
	a = total - b
	print(abs(a - b))


import random
import math
LI = lambda : list(map(int, input().split()))
MI = lambda : map(int, input().split())
yes = lambda : print('Yes')
no = lambda : print('No')
I = lambda : list(input())
J = lambda x: ''.join(x)
II = lambda : int(input())
SI = lambda : input()
t = II()
l = []
tem = 1
for i in range(30):
	tem *= 2
	l.append(tem)
for q in range(t):
	n = II()
	if n == 2:
		print(2)
	else:
		print(2 + 2 * sum(l[:n // 2 - 1]))


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		bigger = 2 ** n
		smaller = 2 ** (n // 2)
		for i in range(1, n // 2):
			bigger += 2 ** i
		for j in range(n // 2, n - 1):
			smaller += 2 ** (j + 1)
		print(bigger - smaller)
main()


import sys
readline = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(2)
		continue
	(a, b) = (2 ** n, 2 ** (n - 1))
	for i in range(1, (n - 2) // 2 + 1):
		a += 2 ** i
		b += 2 ** (n - 1 - i)
	print(abs(a - b))


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print(2)
		continue
	else:
		a = n // 2
		sum_1 = 2 ** n + 2 * (2 ** (a - 1) - 1)
		sum_2 = 2 * (2 ** (n - 1) - 1) - 2 * (2 ** (a - 1) - 1)
		print(sum_1 - sum_2)


t = int(input())
while t > 0:
	n = int(input())
	mass = [2 ** i for i in range(1, n + 1)]
	a = sum([mass[i] for i in range(n // 2 - 1)])
	a += mass[n - 1]
	b = sum([mass[i] for i in range(n // 2 - 1, n - 1)])
	print(abs(a - b))
	t -= 1


t = int(input())
for _ in range(0, t):
	n = int(input())
	if n == 2:
		print(2)
	elif n == 4:
		print(6)
	else:
		temp = 0
		for i in range(1, int(n / 2)):
			temp = temp + 2 ** i
		temp = temp + 2 ** n
		count = 0
		for i in range(int(n / 2), n):
			count = count + 2 ** i
		print(abs(temp - count))


t = int(input())
i = 0
while i < t:
	n = int(input())
	res = []
	j = 1
	r = 1
	while j <= n:
		r = r * 2
		res.append(r)
		j = j + 1
	sum1 = 0
	sum2 = 0
	for x in range(n):
		if x == n - 1:
			sum1 = sum1 + res[x]
		elif x < n // 2 - 1:
			sum1 = sum1 + res[x]
		else:
			sum2 = sum2 + res[x]
	print(sum1 - sum2)
	i = i + 1


t = int(input())
for _ in range(t):
	n = int(input())
	s = 0
	for k in range(1, n // 2):
		s += 2 ** k
	for k in range(n // 2, n):
		s -= 2 ** k
	s += 2 ** n
	print(abs(s))


x = int(input())
for i in range(x):
	b = 0
	n = int(input())
	b += pow(2, n)
	for m in range(1, n // 2):
		b += pow(2, m)
	print(2 * (b - pow(2, n) + 1))


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict as dd, deque as dq
import math, string

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	N = getInt()
	return 2 * (2 ** (N // 2 - 1) - 1) + 2 ** N - 2 ** (N // 2) * (2 ** (N // 2) - 1)
for _ in range(getInt()):
	print(solve())


for i in range(int(input())):
	n = int(input())
	tot = 0
	x = 0
	y = n // 2 - 1
	for i in range(1, n + 1):
		tot += 2 ** i
		if i == y:
			x = tot
	x += 2 ** n
	z = tot - x
	print(abs(x - z))


import sys
import math

def ii():
	return sys.stdin.readline().strip()

def idata():
	return [int(x) for x in ii().split()]

def solve_of_problem():
	n = int(ii())
	ans = 0
	print(pow(2, n // 2 + 1) - 2)
	return
for ______ in range(int(ii())):
	solve_of_problem()


for _ in range(int(input())):
	a = int(input())
	sum1 = 2 ** a
	sum2 = 0
	count1 = 1
	count2 = 0
	for i in range(1, a // 2):
		sum1 += 2 ** i
	for j in range(a // 2, a):
		sum2 += 2 ** j
	print(abs(sum1 - sum2))


tc = int(input())
for t in range(tc):
	n = int(input())
	s1 = 2 * (2 ** (n / 2 - 1) - 1)
	s2 = 2 ** (n / 2 + 1) * (2 ** (n / 2 - 1) - 1)
	s2 = s2 + 2 ** (n / 2)
	s1 = s1 + 2 ** n
	print(int(s1 - s2))


import math
t = int(input())
import math
while t:
	n = int(input())
	print(int(2 * (2 ** (n / 2) - 1)))
	t -= 1


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for tt in range(int(input())):
	n = int(input())
	left = [2 ** n]
	right = []
	for i in range(1, n):
		if len(left) < n // 2:
			left.append(2 ** i)
		else:
			right.append(2 ** i)
	print(abs(sum(left) - sum(right)))


t = int(input())
inputs = [0] * t
for i in range(t):
	inputs[i] = int(input())
for n in inputs:
	print(2 ** (n // 2 + 1) - 2)


def ans(n):
	arr = [2 ** i for i in range(0, n + 1)]
	return arr[n] + sum(arr[1:int(n / 2)]) - sum(arr[int(n / 2):n])
t = int(input())
L = []
for i in range(t):
	n = int(input())
	L.append(ans(n))
for l in L:
	print(l)


from sys import stdin, stdout
for testcases in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = 2 ** n
	for i in range(1, n // 2):
		a += 2 ** i
	b = 0
	for i in range(n // 2, n):
		b += 2 ** i
	print(max(a, b) - min(a, b))


for _ in range(int(input())):
	n = int(input())
	a = []
	for i in range(n):
		a.append(2 ** (i + 1))
	if len(a) == 2:
		print(2)
	else:
		lesser = []
		lesser.append(a.pop(-1))
		for _ in range(n // 2 - 1):
			lesser.append(a.pop(0))
		print(abs(sum(lesser) - sum(a)))


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
for _ in range(ii()):
	n = ii()
	d = [0, 0]
	for i in range(1, n + 1):
		d[n // 2 <= i < n] += 2 ** i
	print(d[0] - d[1])


v = []
(s, p) = (0, 0)
for i in range(int(input())):
	n = int(input())
	for i in range(1, n + 1):
		v.append(2 ** i)
	for j in range(len(v) // 2 - 1):
		s += v[j]
	s += v[-1]
	for k in range(len(v) // 2 - 1, len(v) - 1):
		p += v[k]
	print(s - p)
	v.clear()
	s = 0
	p = 0


def SumOfList(l):
	c = 0
	for f in l:
		c += f
	return c
t = int(input())
for f in range(t):
	n = int(input())
	li = list()
	for i in range(n):
		li.append(2 ** (i + 1))
	s = int(len(li) / 2)
	li1 = []
	for j in range(s - 1):
		li1.append(li.pop(0))
	li1.append(li.pop())
	a1 = SumOfList(li1)
	a2 = SumOfList(li)
	diff = a1 - a2
	print(diff)


import math
import collections
from sys import stdin, stdout
T = int(stdin.readline())
for _ in range(T):
	n = int(stdin.readline())
	a = 0
	for i in range(1, n // 2):
		a += 2 ** i
	for j in range(n // 2, n):
		a -= 2 ** j
	print(a + 2 ** n)


t = int(input())
for tt in range(t):
	n = int(input())
	pile = n // 2
	total_sum = 2 * (2 ** n - 1)
	left = 0
	for i in range(1, pile):
		left += 2 ** i
	left += 2 ** n
	right = total_sum - left
	print(abs(right - left))


t = int(input())
for i in range(t):
	n = int(input())
	pos = n // 2
	left = 0
	right = 0
	for i in range(pos, pos + pos):
		left += 2 ** i
	for i in range(1, n + 1):
		right += 2 ** i
	ans = right - 2 * left
	print(ans)


for t in range(int(input())):
	n = int(input())
	a = [0] * 31
	for i in range(1, 31):
		a[i] = a[i - 1] + pow(2, i)
	print(a[n // 2])


t = int(input())
for _ in range(t):
	n = int(input())
	sum_l = 0
	sum_r = 0
	for i in range(1, n // 2):
		sum_l += 2 ** i
	sum_l += 2 ** n
	for j in range(n // 2, n):
		sum_r += 2 ** j
	print(abs(sum_l - sum_r))


t = int(input())
di = dict()
di[0] = 1
for i in range(1, 31):
	di[i] = di[i - 1] * 2
while t:
	t = t - 1
	n = int(input())
	m = n // 2
	sum1 = 0
	for i in range(1, m):
		sum1 += di[i]
	sum1 += di[n]
	sum = 0
	for i in range(1, n + 1):
		sum += di[i]
	sum2 = sum - sum1
	print(abs(sum1 - sum2))


import math
t = int(input())
for i in range(0, t):
	n = int(input())
	a = []
	for i in range(1, n + 1):
		a.append(math.pow(2, i))
	m = int(n / 2)
	l = [a[n - 1]]
	r = []
	for i in range(0, m - 1):
		l.append(a[i])
	for i in range(m - 1, n - 1):
		r.append(a[i])
	print(abs(int(sum(l) - sum(r))))


t = int(input())
for i in range(t):
	n = int(input())
	list = []
	for j in range(n):
		list.append(pow(2, j + 1))
	onepile = list[-1] + sum(list[0:int(n / 2) - 1])
	secpile = sum(list[int(n / 2) - 1:n - 1])
	print(abs(secpile - onepile))


for i in range(int(input())):
	n = int(input())
	l = []
	for j in range(n):
		l.append(2 ** (j + 1))
	k = max(l)
	p = l[n - 2]
	for j in range(n // 2 - 1):
		k = k + l[j]
		p = p + l[j + (n // 2 - 1)]
	print(k - p)


t = int(input())
for i in range(t):
	value = int(input())
	values = list()
	for i in range(1, value + 1):
		values.append(2 ** i)
	sum = 0
	count = 0
	for i in range(value):
		if i < value / 2 - 1:
			sum += values[i]
		count += values[i]
	sum += values[-1]
	count -= sum
	print(abs(sum - count))


for lo in range(int(input())):
	n = int(input())
	x = 2 ** n
	for i in range(1, n // 2):
		x += 2 ** i
	print(abs(2 ** (n + 1) - 2 - 2 * x))


n = int(input())
for _ in range(n):
	x = int(input())
	ans = pow(2, x / 2)
	ans = (ans - 1) * 2
	print(int(ans))


def f(n):
	left = 0
	right = 2 ** n
	i = n - 1
	for _ in range(n // 2):
		left += 2 ** i
		i -= 1
	for j in range(1, i + 1):
		right += 2 ** j
	return abs(left - right)
t = int(input())
for _ in range(t):
	n = int(input())
	print(f(n))


import math, sys
import heapq
from fractions import Fraction
from collections import Counter, defaultdict

def li():
	return list(map(int, sys.stdin.readline().split()))

def ls():
	return list(map(int, list(input())))

def la():
	return list(input())

def ii():
	return int(input())

def dic(x):
	return defaultdict(lambda : x)

def isPrime(n):
	i = 2
	if n == 1:
		return False
	while i <= int(math.sqrt(n)):
		if n % i == 0:
			return False
		i = i + 1
	return True

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def LCM(a, b):
	return a * b / gcd(a, b)
t = ii()
for _ in range(t):
	n = ii()
	if n == 2:
		print(2)
	else:
		total1 = 2 ** n
		for i in range(1, n // 2):
			total1 += 2 ** i
		total2 = 0
		for i in range(n // 2, n):
			total2 += 2 ** i
		print(abs(total1 - total2))


mod = int(1000000000.0) + 7

def ip():
	return int(input())

def Ip():
	return map(int, input().split())
from math import pow
for _ in range(0, int(input())):
	n = ip()
	if n == 2:
		print(2)
	else:
		(a, b) = (0, pow(2, n))
		for i in range(1, n // 2):
			b += pow(2, i)
		for i in range(n // 2, n):
			a += pow(2, i)
		print(int(abs(a - b)))


def first(n1):
	return (2 ** n1 - 1) * 2
for _ in range(int(input())):
	n = int(input())
	x = 2 ** n | first(n // 2 - 1)
	print(x - (first(n) - x))


import sys
sys.setrecursionlimit(2000)
from collections import Counter
from functools import reduce
t = [int(val) for val in sys.stdin.readline().split()][0]
for test in range(t):
	n = [int(val) for val in sys.stdin.readline().split()][0]
	a = [2 ** (i + 1) for i in range(n)]
	half = n // 2
	m1 = [a[-1]] + a[:half - 1]
	m2 = a[half - 1:-1]
	print(sum(m1) - sum(m2))


n = int(input())
for i in range(n):
	k = int(input())
	sum1 = 2 ** k + 2 ** (k // 2) - 2
	sum2 = 2 ** (k + 1) - 2 - sum1
	print(abs(sum2 - sum1))


from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def powmod(a, b):
	a %= mod
	if a == 0:
		return 0
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % mod
		a = a * a % mod
		b >>= 1
	return res

def solve():
	for _ in range(ii()):
		n = ii()
		s1 = 0
		s2 = 0
		for i in range(n // 2, n):
			s2 += pow(2, i)
		for i in range(1, n // 2):
			s1 += pow(2, i)
		s1 += pow(2, n)
		print(abs(s1 - s2))
solve()


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	a = 2 ** n
	end = n // 2
	b = 0
	for i in range(1, end):
		a = a + 2 ** i
	for i in range(end, n):
		b = b + 2 ** i
	print(abs(a - b))


def min_abs(n):
	coins = [2 ** i for i in range(1, n + 1)]
	pile_a = sum([coins[-1]] + coins[:n // 2 - 1])
	pile_b = sum(coins[n // 2 - 1:n - 1])
	return abs(pile_a - pile_b)
T = int(input())
while T:
	T -= 1
	n = int(input())
	print(min_abs(n))


weight = []
p = 1
for i in range(1, 31):
	p *= 2
	weight.append(p)
for i in range(int(input())):
	n = int(input())
	w = weight[:n]
	a = [w[n - 1]] + w[:n // 2 - 1]
	b = w[n // 2 - 1:n - 1]
	print(sum(a) - sum(b))


t = [2]
for k in range(1, 16):
	f = 2 + t[-1] * 2
	t.append(f)
for k in range(int(input())):
	a = int(input())
	print(t[a // 2 - 1])


t = int(input(''))
z = 0
while z < t:
	n = int(input(''))
	i = 2
	s = 0
	lis = list()
	while i < 1000000:
		if i == n:
			s = 2 ** i
			lis.append(s)
			break
		else:
			s = 2 ** i
			lis.append(s)
		i += 1
	lis.append(2)
	lis.sort()
	res = 0
	if n == 2:
		res = lis[1] - lis[0]
	else:
		a = int(n / 2 - 1)
		j = 0
		p = 0
		while j < a:
			p = p + lis[j]
			j += 1
		p_1 = p + lis[n - 1]
		k = int(n / 2)
		q = 0
		while k < n:
			q = q + lis[k - 1]
			k += 1
		q_1 = q
		re = p_1 - q_1
		res = abs(re)
	print(res)
	z += 1


def res(n):
	a = int()
	b = int()
	a = 2 ** n
	for i in range(1, n // 2):
		a = a + 2 ** i
	for i in range(n // 2, n):
		b = b + 2 ** i
	return a - b
for i in range(0, int(input())):
	print(res(int(input())))


for _ in range(int(input())):
	N = int(input())
	s1 = pow(2, N)
	s2 = 0
	for i in range(1, N // 2):
		s1 += pow(2, i)
	for i in range(N // 2, N):
		s2 += pow(2, i)
	print(abs(s1 - s2))


t = int(input())
for num in range(t):
	l = []
	b = []
	n = int(input())
	for i in range(1, n + 1):
		l.append(pow(2, i))
	x = n // 2
	for i in range(x):
		if i + 1 == x:
			b.append(l[n - 1])
			l[n - 1] = 0
		else:
			b.append(l[i])
			l[i] = 0
	print(sum(b) - sum(l))


t = int(input())
for l in range(t):
	n = int(input())
	a = 2 ** n
	k = 1
	b = 0
	while k < n / 2:
		a = 2 ** k + a
		k += 1
	while k < n:
		b = 2 ** k + b
		k += 1
	if b > a:
		print(b - a)
	else:
		print(a - b)


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	x = n // 2
	i = 0
	d = []
	d1 = []
	while i != x - 1:
		d.append(l[i])
		i += 1
	d.append(l[-1])
	while i < n - 1:
		d1.append(l[i])
		i += 1
	print(abs(sum(d) - sum(d1)))


for _ in range(int(input())):
	n = int(input())
	a1 = []
	for i in range(1, n + 1):
		a1.append(2 ** i)
	a = a1[-1] + sum(a1[:n // 2 - 1])
	b = sum(a1[n // 2 - 1:n - 1])
	print(abs(a - b))


nums = [pow(2, i) for i in range(1, 31)]
t = int(input())
for test in range(t):
	n = int(input())
	a = n // 2
	sum1 = sum(nums[:a - 1]) + nums[n - 1]
	sum2 = sum(nums[a - 1:n - 1])
	print(abs(sum2 - sum1))


t = int(input())
for _ in range(t):
	c = int(input())
	pile1 = 0
	for i in range(1, c + 1):
		if i < c / 2 or i == c:
			pile1 += 2 ** i
		else:
			pile1 -= 2 ** i
	print(abs(pile1))


cases = int(input())
for x in range(cases):
	n = int(input())
	print(2 ** (n // 2 + 1) - 2)


for _ in range(int(input())):
	N = int(input())
	X = []
	for i in range(1, N + 1):
		X.append(2 ** i)
	val = 2 * (2 ** N - 1)
	t = N // 2
	x = 0
	for i in range(N // 2 - 1):
		x += X[i]
	x += X[-1]
	print(x - val + x)


import math
testcase = int(input())
ans = []
for i in range(testcase):
	num = int(input())
	arr = []
	for i in range(1, num + 1, 1):
		arr.append(math.pow(2, i))
	left = arr.pop()
	right = arr.pop()
	a = len(arr) / 2
	left = left + sum(arr[:int(len(arr) / 2)])
	right = right + sum(arr[int(len(arr) / 2):len(arr)])
	ans.append(abs(left - right))
for i in ans:
	print(int(i))


T = int(input())
for t in range(T):
	n = int(input())
	heap1 = 2 ** n
	n -= 1
	heap2 = 2 ** n
	n -= 1
	n_ = n // 2
	while n > n_:
		heap2 += 2 ** n
		n -= 1
	while n > 0:
		heap1 += 2 ** n
		n -= 1
	print(abs(heap1 - heap2))


t = int(input())
for i in range(t):
	monet = int(input())
	powers = []
	for i in range(1, monet + 1):
		powers.append(pow(2, i))
	new = [powers[-1]]
	powers.pop()
	j = 1
	for i in range(len(powers)):
		new.append(powers[i])
	sum1 = 0
	for i in range(len(new) // 2):
		sum1 += new[i]
	sum2 = 0
	for i in range(len(new) // 2, len(new)):
		sum2 += new[i]
	print(abs(sum1 - sum2))


from sys import stdin, stdout
a = [2]
for i in range(32):
	a += [a[-1] * 2]
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	ans = sum(a[:n // 2 - 1]) + a[n - 1] - sum(a[n // 2 - 1:n - 1])
	stdout.write(str(ans) + '\n')


for _ in range(int(input())):
	n = int(input())
	cnt = n / 2 - 1
	(mx, mn) = (2 ** n, 0)
	for i in range(1, n):
		if cnt:
			mx += 2 ** i
			cnt -= 1
		else:
			mn += 2 ** i
	print(abs(mn - mx))


def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))
t = read_int()
for case_num in range(t):
	n = read_int()
	total = 2 ** (n + 1) - 2
	left = 2 ** (n // 2) - 2 + 2 ** n
	right = total - left
	print(left - right)


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
t = ini()
for _ in range(t):
	n = ini()
	ans = 0
	for i in range(1, n + 1):
		if i < n // 2 or i == n:
			ans += 2 ** i
		else:
			ans -= 2 ** i
	print(ans)


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = [None] * T
for qu in range(T):
	N = int(readline())
	Ans[qu] = 2 ** (N // 2 + 1) - 2
print('\n'.join(map(str, Ans)))


def solve(n):
	cnt1 = 2 ** n + 2 ** (n // 2) - 2
	cnt2 = 2 ** (n + 1) - 2 - cnt1
	return cnt1 - cnt2
n = int(input())
for _ in range(n):
	temp = int(input())
	print(solve(temp))


from sys import stdin
cases = int(stdin.readline().strip())
for i in range(cases):
	n = int(stdin.readline().strip())
	minimo = 2 ** (n // 2 + 1) - 2
	print(minimo)


for i in range(int(input())):
	n = int(input())
	l = []
	for j in range(1, n + 1):
		p = 2 ** j
		l += [p]
	else:
		t = [l[-1]] + l[:n - 1]
		print(sum(t[:n // 2]) - sum(t[n // 2:]))


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = 2 ** n
	b = 2 ** (n - 1)
	ca = 1
	cb = 1
	i = n - 2
	while i > 0:
		if a < b and ca < n // 2:
			a = a + 2 ** i
			ca += 1
		elif b < a and cb == n // 2:
			a = a + 2 ** i
		else:
			b = b + 2 ** i
			cb += 1
		i -= 1
	if a < b:
		print(b - a)
	else:
		print(a - b)


t = int(input())
for i in range(t):
	l = []
	n = int(input())
	for i in range(1, n + 1):
		l.append(2 ** i)
	s1 = max(l)
	s2 = 0
	l.remove(s1)
	for i in range(n // 2 - 1):
		s1 += min(l)
		l.remove(min(l))
	s2 = sum(l)
	print(s1 - s2)


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	left = 0
	for index in range(n - int(n / 2), n):
		left += pow(2, index)
	right = 0
	for index in range(1, int(n / 2)):
		right += pow(2, index)
	right += pow(2, n)
	diff = right - left
	print(diff)


t = int(input())
for _ in range(t):
	n = int(input())
	b = 2 ** n
	a = 2 ** (n - 1)
	for p in range(1, int(n / 2)):
		b += 2 ** p
		a += 2 ** (n - p - 1)
	print(abs(a - b))


n = int(input())
for i in range(n):
	m = int(input())
	if m == 2:
		print(2)
	else:
		list_of_numbers = []
		for j in range(1, m + 1):
			list_of_numbers.append(2 ** j)
		first_group = list_of_numbers[-1]
		second_group = 0
		for k in range(m // 2 - 1):
			first_group += list_of_numbers[k]
		for l in range(m // 2 - 1, m - 1):
			second_group += list_of_numbers[l]
		print(first_group - second_group)


t = int(input())
for i in range(t):
	n = int(input())
	div = n // 2
	nums = []
	for l in range(1, n + 1):
		nums.append(2 ** l)
	add = []
	for z in range(div - 1):
		add.append(nums[z])
	add.append(nums[-1])
	print(abs(sum(nums) - sum(add) - sum(add)))


import sys
input = sys.stdin.readline
t = int(input())
for r in range(t):
	n = int(input())
	arr = []
	for i in range(1, n + 1):
		arr.append(pow(2, i))
	i = 0
	j = n - 1
	count1 = 0
	count2 = 0
	count2 += arr[n - 1]
	i = n - 2
	count = 0
	while count < n // 2:
		count1 += arr[i]
		i -= 1
		count += 1
	while i >= 0:
		count2 += arr[i]
		i -= 1
	print(abs(count1 - count2))


for _ in range(int(input())):
	x = int(input())
	a = [2 ** i for i in range(1, x + 1)]
	print(sum(a) - 2 * sum(a[x // 2 - 1:x - 1]))


t = int(input())
coins = []
for i in range(t):
	coins.append(int(input()))
for coin in coins:
	wei = []
	for i in range(coin):
		wei.append(2 ** (i + 1))
	l = len(wei) // 2
	first = wei[-1]
	for i in range(l - 1):
		first += wei[i]
	second = 0
	for i in range(l, len(wei)):
		second += wei[i - 1]
	min = first - second
	print(min)


t = int(input())
for i in range(0, t):
	n = int(input())
	total = 2 * (2 ** n - 1)
	p1 = 2 ** n + 2 * (2 ** (int(n / 2) - 1) - 1)
	print(2 * p1 - total)


for i in range(int(input())):
	n = int(input())
	L = []
	for i in range(1, n + 1):
		L.append(2 ** i)
	print(sum(L[:n // 2 - 1]) + L[-1] - sum(L[n // 2 - 1:-1]))


data = [1, 2]
for i in range(29):
	data.append(data[-1] * 2)
for _ in range(int(input())):
	n = int(input())
	print(data[n] + sum(data[1:n // 2]) - sum(data[n // 2:n]))


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
import math

def takeInput():
	return [int(x) for x in input().strip().split()]
t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	c1 = pow(2, n)
	c2 = 0
	half = n // 2
	for i in range(1, half):
		c1 += pow(2, i)
	for i in range(half, n):
		c2 += pow(2, i)
	print(c1 - c2)


def compute(n):
	(sum1, sum2) = (1 << n, 0)
	for i in range(1, int(n / 2)):
		sum1 += 1 << i
	for i in range(int(n / 2), n):
		sum2 += 1 << i
	return sum1 - sum2
testcases = int(input())
for i in range(testcases):
	print(compute(int(input())))


t = int(input())
while t != 0:
	t = t - 1
	n = int(input())
	a1 = pow(2, n // 2) - 2
	a2 = pow(2, n) - 2 - a1
	ans = a1 - a2 + pow(2, n)
	print(ans)


cases = int(input())
for i in range(cases):
	a = int(input())
	l = a // 2
	print(2 * (pow(2, l) - 1))


n = int(input())
nums = [int(input()) for _ in range(n)]
for num in nums:
	sum1 = 0
	sum2 = 0
	low = 1
	high = num - 2
	sum1 += pow(2, num)
	sum2 += pow(2, num - 1)
	while low < high:
		sum1 += pow(2, low)
		sum2 += pow(2, high)
		low += 1
		high -= 1
	print(abs(sum1 - sum2))


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		print(case(n))

def sum2(n):
	return 2 ** (n + 1) - 2

def case(n):
	i = n // 2
	a = 2 ** n + sum2(i - 1)
	b = sum2(n) - a
	return abs(a - b)
main()


import math
t = int(input())
for _ in range(t):
	n = int(input())
	total = 0
	big = 0
	for i in range(1, n + 1):
		total += int(pow(2, i))
	for i in range(1, n // 2):
		big += int(pow(2, i))
	big += int(pow(2, n))
	print(abs(big - (total - big)))


t = int(input())
dva = [2 ** i for i in range(31)]
for i in range(t):
	n = int(input())
	a = dva[n] + sum(dva[1:n // 2])
	b = sum(dva[n // 2:n])
	print(abs(a - b))


t = int(input())
for i in range(t):
	n = int(input())
	a = 2 ** n + (2 ** (n / 2) - 2)
	b = 2 ** (n + 1) - 2 - a
	diff = abs(a - b)
	print(int(diff))


t = int(input())
for i in range(t):
	n = int(input())
	s1 = 0
	s2 = 0
	a = n // 2
	for i in range(1, a):
		s1 = s1 + pow(2, i)
		i += 1
	s1 = s1 + pow(2, n)
	for j in range(a, n):
		s2 = s2 + pow(2, j)
	result = s1 - s2
	print(result)


t = int(input())
k = []
for i in range(t):
	n = int(input())
	a = [2 ** i for i in range(1, n + 1)]
	k.append(abs(sum(a[:len(a) // 2 - 1]) - sum(a[len(a) // 2 - 1:-1]) + a[-1]))
for i in k:
	print(i)


T = int(input())
for i in range(T):
	n = int(input())
	print(2 ** (n // 2 + 1) - 2)


n = int(input())
answer = list()
for i in range(n):
	m = int(input())
	(pile1, pile2, max) = (0, 0, 0)
	a = m - 1
	while a > m - 1 - m // 2:
		pile1 += 2 ** a
		a -= 1
	while a >= 1:
		pile2 += 2 ** a
		a -= 1
	pile2 += 2 ** m
	answer.append(abs(pile1 - pile2))
for i in answer:
	print(i)


T = int(input())
for _ in range(T):
	N = int(input())
	a = 1 << N
	for i in range(1, N // 2):
		a += 1 << i
	for i in range(N // 2, N):
		a -= 1 << i
	print(a)


rr = lambda : input().strip()
rri = lambda : int(rr())
rrm = lambda : [int(x) for x in rr().split()]
from math import gcd
from sys import stdin, stdout

def sol():
	n = rri()
	res = 2 ** n
	for i in range(1, n // 2):
		res += 2 ** i
	for i in range(n // 2, n):
		res -= 2 ** i
	print(res)
T = rri()
for _ in range(T):
	sol()


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	n = ii()
	print(2 ** (n // 2 + 1) - 2)


for _ in range(int(input())):
	n = int(input())
	array = [2 ** x for x in range(1, n + 1)]
	array = array[::-1]
	(array1, array2) = ([], [])
	for element in array:
		if sum(array1) <= sum(array2):
			if 2 * len(array1) != len(array):
				array1.append(element)
			else:
				array2.append(element)
		elif 2 * len(array2) != len(array):
			array2.append(element)
		else:
			array1.append(element)
	print(abs(sum(array1) - sum(array2)))


for _ in ' ' * int(input()):
	a = int(input())
	z = [2 ** i for i in range(1, a + 1)]
	s = z[-1]
	z.remove(s)
	for i in range(a // 2 - 1):
		s += z[i]
	print(abs(s - sum(z[a // 2 - 1:])))


t = int(input())
powers = [pow(2, i + 1) for i in range(31)]
for _ in range(t):
	n = int(input())
	a = sum(powers[:n // 2 - 1]) + powers[n - 1]
	b = sum(powers[:n]) - a
	ans = abs(a - b)
	print(ans)


numcases = int(input())
for i in range(numcases):
	n = int(input())
	sum = 0
	sum2 = 0
	for i in range(1, n):
		sum = sum + 2 ** i
		if i == n / 2 - 1:
			sum2 = sum
			sum = 0
	sum2 = sum2 + 2 ** n
	print(sum2 - sum)


import sys
I = sys.stdin.readline
pr = sys.stdout.write

def main():
	for _ in range(int(I())):
		n = int(I())
		i = 1
		s = 2 ** n
		while i <= n // 2:
			s -= 2 ** (n - i)
			i += 1
		while i < n:
			s += 2 ** (n - i)
			i += 1
		pr(str(s))
		pr('\n')
main()


n = int(input())
for i in range(n):
	a = int(input())
	d = 0
	j = 1
	while j <= a / 2 - 1:
		d = d + 2 ** j
		j = j + 1
	d = d + 2 ** a
	k = 0
	while j <= a - 1:
		k = k + 2 ** j
		j = j + 1
	print(abs(d - k))


t = int(input())
for i in range(t):
	x = int(input())
	a = [0] * x
	sum_1 = 0
	sum_2 = 0
	for j in range(x):
		a[j] = 2 ** (j + 1)
	for i in range(x // 2 - 1):
		sum_1 += a[i]
	sum_1 += a[-1]
	for i in range(x // 2 - 1, x - 1):
		sum_2 += a[i]
	print(sum_1 - sum_2)


t = int(input())
tp = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368]
for _ in range(t):
	n = int(input())
	req = tp[:n]
	req = req[::-1]
	a = req[0]
	b = sum(req[1:int(n / 2) + 1])
	a += sum(req[int(n / 2) + 1:])
	print(abs(a - b))


t = int(input())
for x in range(t):
	n = int(input())
	lim = n // 2
	l1 = [2 ** i for i in range(1, lim)]
	l2 = [2 ** i for i in range(lim, n)]
	l1.append(2 ** n)
	print(abs(sum(l1) - sum(l2)))


t = int(input())
for i in range(1, t + 1):
	m = int(input())
	print(2 ** (m // 2 + 1) - 2)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	array = [pow(2, item) for item in range(1, n + 1)]
	vala = sum(array[:n // 2 - 1]) + array[-1]
	valb = sum(array) - vala
	print(abs(vala - valb))


def main():
	t = int(input())
	for __ in range(t):
		n = int(input())
		print(int(2 ** n + (2 ** (n / 2) - 2) - (2 ** n - 2 - (2 ** (n / 2) - 2))))
main()


for _ in range(int(input())):
	n = int(input())
	a = [0] * n
	a[0] = 2
	for i in range(1, n):
		a[i] = 2 * a[i - 1]
	temp = a[-1]
	for i in range(n // 2 - 1):
		temp += a[i]
	print(temp - (sum(a) - temp))


ans = {n: int(2 ** (n / 2 + 1) - 2) for n in range(2, 32, 2)}
t = int(input())
n_ = [int(input()) for i in range(t)]
for n in n_:
	print(ans[n])


t = int(input())
for i in range(t):
	n = int(input())
	ans = 0
	for j in range(1, n // 2):
		ans += 2 ** j
	ans1 = 0
	for j in range(n // 2, n):
		ans1 += 2 ** j
	ans += 2 ** n
	print(ans - ans1)


import math
t = int(input())
for dud in range(t):
	n = int(input())
	y = int(n / 2)
	total = int(math.pow(2, n))
	for x in range(1, y):
		total += math.pow(2, x)
	for x in range(y, n):
		total -= math.pow(2, x)
	print(int(total))


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2:
		print(2)
	else:
		arr = [0] * 16
		arr[1] = 2
		for i in range(2, 16):
			arr[i] = arr[i - 1] + pow(2, i)
		print(arr[n // 2])


a = int(input())
for i in range(a):
	n = int(input())
	print(2 ** (n // 2 + 1) - 2)


for _ in range(int(input())):
	n = int(input())
	temp = n // 2
	sum1 = pow(2, temp) - 1
	sum1 = sum1 * pow(2, temp)
	sum2 = pow(2, temp - 1) - 1
	sum2 = sum2 * 2
	sum2 += pow(2, n)
	print(sum2 - sum1)


for _ in range(int(input())):
	l = int(input())
	l1 = []
	for i in range(1, l + 1):
		l1.append(2 ** i)
	if len(l1) == 2:
		print(l1[1] - l1[0])
	else:
		j = l // 2
		n = j // 2
		s1 = sum(l1)
		f = 2 + j
		s = l1[j - 1:j + j - 1]
		s2 = sum(s)
		s3 = s1 - s2
		print(abs(s2 - s3))


def solve(n):
	(first, second) = (0, 0)
	totalElements = n / 2
	first = 2 ** n
	i = 1
	count = 1
	while count != totalElements:
		first += 2 ** i
		count += 1
		i += 1
	while i < n:
		second += 2 ** i
		i += 1
	return abs(first - second)
testcases = int(input())
for i in range(0, testcases):
	print(solve(int(input())))


power2 = [0 for i in range(31)]
power2[0] = 1
for i in range(1, 31):
	power2[i] = 2 * power2[i - 1]
t = int(input())
for _ in range(t):
	n = int(input())
	print(power2[n // 2 + 1] - 2)


input_ints = input()
tests = []
for _ in range(int(input_ints)):
	tests.append(int(input()))
for iterator in range(len(tests)):
	coins_list = []
	for discriminator in range(1, tests[iterator] + 1):
		coins_list.append(2 ** discriminator)
	pile_one = []
	pile_two = []
	pile_one = sum(coins_list[:len(coins_list) // 2 - 1]) + coins_list[-1]
	pile_two = sum(coins_list[len(coins_list) // 2 - 1:-1])
	print(pile_one - pile_two)


from sys import stdin, stdout

def minCal(X):
	sumAll = pow(2, X + 1) - 2
	sumLeft = pow(2, X // 2) - 2
	sumMid = pow(2, X) - 2 - sumLeft
	diff = sumAll - 2 * sumMid
	return diff

def main():
	T = int(stdin.readline())
	for t in range(T):
		X = int(stdin.readline())
		result = minCal(X)
		print(result)
main()


import sys
import random
import math
from sys import stdin, stdout

def get_ints():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
n = int(input())
a = [0] * int(n)
for i in range(0, n):
	a[i] = int(input())
for i in range(0, n):
	s = 2 ** a[i]
	for k in range(1, a[i] // 2):
		s += 2 ** k
	s1 = 0
	for k in range(a[i] // 2, a[i]):
		s1 += 2 ** k
	stdout.write(str(abs(s - s1)))
	stdout.write('\n')


import sys
input = sys.stdin.readline
from math import *

def eprint(*args):
	print(*args, file=sys.stderr)
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [2 ** i for i in range(1, n + 1)]
	print(abs(a[-1] + sum(a[:n // 2 - 1]) - sum(a[n // 2 - 1:n - 1])))


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def get_str():
	return input().decode().strip()

def rint():
	return map(int, input().split())

def oint():
	return int(input())
t = oint()
for _ in range(t):
	n = oint()
	a = 0
	for i in range(1, n // 2):
		a += 2 ** i
	a += 2 ** n
	b = 0
	for i in range(n // 2, n):
		b += 2 ** i
	print(abs(b - a))


import bisect as bi
import sys
import collections as cc
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	n = int(input())
	a = [2 ** i for i in range(1, n + 1)]
	x = [a[-1]] + a[:-(n // 2) - 1]
	b = sum(a) - sum(x)
	print(abs(sum(x) - b))


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	w = (1 << n // 2) - 2
	x = (1 << n) + w
	y = (1 << n) - 2 - w
	print(x - y)


for _ in range(int(input())):
	n = int(input())
	diff = 2
	diff += 2 * (2 ** (n // 2) - 2)
	print(diff)


def f(n):
	l = list(map(lambda x: 2 ** x, list(range(1, n + 1))))
	l1 = l[:n // 2 - 1] + [l[-1]]
	l2 = l[n // 2 - 1:-1]
	return abs(sum(l1) - sum(l2))
for i in range(int(input())):
	n = int(input())
	print(f(n))


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	for t in range(I()):
		n = I()
		(a, b) = (int(math.pow(2, n - 1)), int(math.pow(2, n)))
		for i in range(1, n // 2):
			if a >= b:
				a += int(math.pow(2, i))
				b += int(math.pow(2, n - i - 1))
			else:
				a += int(math.pow(2, n - i - 1))
				b += int(math.pow(2, i))
		print(int(abs(a - b)))
main()


li = [2 ** i for i in range(1, 31)]
a = int(input())
for i in range(a):
	x = int(input())
	ki = li[:x]
	su = sum(ki)
	mi = 0
	co = 0
	val = 0
	if x == 2:
		print(2)
		continue
	nli = ki[x - 1:]
	co = 1
	vli = ki[:x // 2 - 1]
	gli = nli + vli
	su = abs(sum(ki) - 2 * sum(gli))
	print(su)


test_cases = int(input())
for i in range(test_cases):
	n = int(input())
	split = n // 2 - 1
	powers = [2 ** i for i in range(1, n + 1)]
	pile_1 = [powers[-1]] + powers[:split]
	pile_2 = powers[split:-1]
	print(abs(sum(pile_1) - sum(pile_2)))


import sys
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	n = int(I())
	my_list = []
	for i in range(1, n + 1):
		my_list.append(2 ** i)
	s = sum(my_list)
	if n // 2 % 2 == 0:
		x = n // 2
		a = sum(my_list[0:x - 1]) + my_list[-1]
		b = s - a
	else:
		x = n // 2
		if x > 1:
			a = sum(my_list[0:x - 1]) + my_list[-1]
			b = s - a
		else:
			a = my_list[0]
			b = my_list[1]
	ans += str(abs(a - b)) + '\n'
print(ans)


from __future__ import division, print_function
import os, sys
import math
import collections
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def padded_bin_with_complement(x):
	if x < 0:
		return bin(2 ** 16 - abs(x))[2:].zfill(16)
	else:
		return bin(x)[2:].zfill(16)

def binaryToDecimal(binary):
	binary1 = binary
	(decimal, i, n) = (0, 0, 0)
	while binary != 0:
		dec = binary % 10
		decimal = decimal + dec * pow(2, i)
		binary = binary // 10
		i += 1
	print(decimal)

def CountFrequency(arr):
	return collections.Counter(arr)

def main():
	for _ in range(ii()):
		n = ii()
		res1 = 2 ** n
		res2 = 2 ** (n - 1)
		j = n - 2
		for i in range((n - 2) // 2):
			res2 += 2 ** j
			j -= 1
		for i in range(n // 2 - 1):
			res1 += 2 ** j
			j -= 1
		print(abs(res1 - res2))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	ans = 0
	if n == 2:
		print('2')
	else:
		arr1 = [2 ** n]
		arr2 = [2 ** (n - 1)]
		for i in range(1, n // 2):
			arr1.append(2 ** i)
			arr2.append(2 ** (n - i - 1))
		print(abs(sum(arr1) - sum(arr2)))


from collections import *
from bisect import *
from math import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n == 2:
		print(2)
	else:
		a = []
		for i in range(1, n + 1):
			a.append(pow(2, i))
		s = 0
		s1 = 0
		for i in range(n // 2 - 1):
			s += a[i]
		s += a[-1]
		for i in range(n // 2 - 1, n - 1):
			s1 += a[i]
		print(int(abs(s - s1)))


def calc(x):
	val1 = 2 ** x
	val2 = 0
	if x > 2:
		for i in range(1, int(x / 2)):
			val1 += 2 ** i
		for j in range(int(x / 2), x):
			val2 += 2 ** j
		print(val1 - val2)
	elif x == 2:
		print(2)
t = int(input())
for i in range(0, t):
	n = int(input())
	ans = calc(n)
quit()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	sm = 0
	k = n // 2
	k -= 1
	for i in range(1, k + 1):
		sm += 1 << i
	sm += 1 << n
	b = 0
	for i in range(k + 1, n):
		b += 1 << i
	print(abs(sm - b))


from pprint import pprint
import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	n = int(input())
	if n == 2:
		print(2)
	else:
		a = '1'
		b = '0'
		for i in range(n // 2):
			a += '0'
			b += '1'
		for i in range(n // 2 - 1):
			a += '1'
			b += '0'
		a += '0'
		b += '0'
		a = int(a, 2)
		b = int(b, 2)
		print(abs(a - b))


t = int(input())
for i in range(t):
	n = int(input())
	side = n // 2
	main = []
	j = 1
	while j <= n:
		main.append(2 ** j)
		j += 1
	left = []
	right = []
	left.append(main[-1])
	j = 0
	while j < side - 1:
		left.append(main[j])
		j += 1
	j = side - 1
	while j < len(main) - 1:
		right.append(main[j])
		j += 1
	print(abs(sum(left) - sum(right)))


t = int(input())
while t > 0:
	x = int(input())
	arr = [2 ** i for i in range(1, x + 1)]
	arr1 = arr[:int(x / 2 - 1)]
	arr2 = arr[int(x / 2 - 1):x - 1]
	print(sum(arr1) - sum(arr2) + arr[-1])
	t -= 1


from collections import deque
t = int(input())
rez = []
for i in range(t):
	n = int(input())
	a = 0
	b = 0
	for j in range(1, int(n / 2)):
		a += 2 ** j
	a += 2 ** n
	for j in range(int(n / 2), n):
		b += 2 ** j
	rez.append(abs(a - b))
for i in range(t):
	print(rez[i])


from sys import stdin
from sys import stdout
sprint = stdout.write
sinput = stdin.readline

def func():
	n = int(sinput())
	a = 2 ** (n // 2 + 1) - 2
	print(a)
t = int(sinput())
while t != 0:
	if t == 1000 - 84 + 1 + t:
		int(sinput())
		sprint()
		t -= 1
	else:
		t -= 1
		func()


t = int(input())
for i in range(t):
	n = int(input())
	weights = [pow(2, i) for i in range(1, n + 1)]
	chance = 'a'
	sumA = weights[n - 1]
	sumB = weights[n - 2]
	i = n - 3
	j = 0
	while n > 2:
		if chance == 'a':
			if sumA > sumB:
				sumA += weights[j]
				j += 1
				n -= 1
			else:
				sumA += weights[i]
				i -= 1
				n -= 1
			chance = 'b'
		else:
			if sumB > sumA:
				sumB += weights[j]
				j += 1
				n -= 1
			else:
				sumB += weights[i]
				i -= 1
				n -= 1
			chance = 'a'
	print(abs(sumA - sumB))


def coins(number):
	index = 1
	first = [2 ** number]
	second = []
	for i in range(number // 2 - 1):
		first.append(2 ** index)
		index = index + 1
	for j in range(number // 2, number):
		second.append(2 ** index)
		index = index + 1
	return sum(first) - sum(second)
t = int(input())
for i in range(t):
	number = int(input())
	print(coins(number))


ileP = int(input())
for i in range(ileP):
	wyn = 2
	tmp = int(input())
	if tmp == 2:
		print(2)
	else:
		for j in range(2, tmp, 2):
			wyn = (wyn + 1) * 2
		print(wyn)


t = int(input())

def pow2(k):
	if k == 0:
		return 1
	u = pow2(k // 2)
	if k % 2:
		return u * u * 2
	return u * u

def sol():
	n = int(input())
	return 2 * pow2(n // 2) - 2
for _ in range(t):
	print(sol())


import math
for _ in range(int(input())):
	t = int(input())
	print(int(math.pow(2, t / 2 + 1) - 2))


t = int(input())

def main(n):
	a = 0
	for i in range(1, int(n / 2)):
		a += 2 ** i
	a += 2 ** n
	b = 0
	for i in range(int(n / 2), n):
		b += 2 ** i
	return abs(a - b)
for _ in range(t):
	k = int(input())
	print(main(k))


arr = [pow(2, i) for i in range(1, 31)]
for _ in range(int(input())):
	n = int(input())
	temp1 = 0
	temp2 = 0
	for i in range(n):
		if i < n // 2 - 1 or i == n - 1:
			temp1 += arr[i]
		else:
			temp2 += arr[i]
	print(temp1 - temp2)


t = int(input())
s = []
for i in range(t):
	s.append(int(input()))
for n in s:
	r1 = 2 ** n
	r2 = 2 ** (n - 1)
	for k in range(1, n // 2):
		r1 = r1 + 2 ** k
		r2 = r2 + 2 ** (n - k - 1)
	print(abs(r1 - r2))


for i in range(int(input())):
	n = int(input())
	x = 1
	a = 0
	for j in range(n):
		x *= 2
		if j < n / 2 - 1 or j == n - 1:
			a -= x
		else:
			a += x
	print(abs(a))


for k in range(int(input())):
	a = int(input())
	l = []
	for i in range(1, a + 1):
		l.append(2 ** i)
	p = l[-1]
	q = 0
	for i in range(a // 2 - 1):
		p += l[i]
	for j in range(a // 2 - 1, a - 1):
		q += l[j]
	print(abs(p - q))


def solution(arr, x, y):
	setSize = len(x)
	pos1 = 0
	pos2 = 0
	i = len(arr) - 1
	sum1 = 0
	sum2 = 0
	while pos1 < setSize and pos2 < setSize:
		if sum1 < sum2:
			x[pos1] = arr[i]
			pos1 += 1
			sum1 += arr[i]
		else:
			y[pos2] = arr[i]
			pos2 += 1
			sum2 += arr[i]
		i -= 1
	while i >= 0:
		if pos1 < setSize:
			x[pos1] = arr[i]
			pos1 += 1
		else:
			y[pos2] = arr[i]
			pos2 += 1
		i -= 1
	return abs(sum(x) - sum(y))
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [pow(2, i) for i in range(1, n + 1)]
	x = [0] * (n // 2)
	y = [0] * (n // 2)
	print(solution(arr, x, y))


for _ in range(int(input())):
	(pilhaa, pilhab) = (list(), list())
	numeros = list()
	size = int(input())
	for i in range(size):
		numeros.append(2 ** (i + 1))
	numeros.reverse()
	for valor in numeros:
		if len(pilhab) == size / 2:
			pilhaa.append(valor)
		elif len(pilhaa) == size / 2:
			pilhab.append(valor)
		elif sum(pilhab) < sum(pilhaa):
			pilhab.append(valor)
		else:
			pilhaa.append(valor)
	print(abs(sum(pilhaa) - sum(pilhab)))


import math
for _ in range(int(input())):
	n = int(input())
	x = 0
	y = 0
	for i in range(1, n):
		if i < n // 2:
			x = x + int(math.pow(2, i))
		else:
			y = y + int(math.pow(2, i))
	x = x + int(math.pow(2, n))
	print(x - y)


t = int(input())
for i in range(t):
	n = int(input())
	k = n // 2
	s1 = 0
	for i in range(1, k):
		s1 += 2 ** i
	s1 += 2 ** n
	s2 = 0
	for i in range(k, n):
		s2 += 2 ** i
	print(s1 - s2)


for q in range(int(input())):
	frstbag = 0
	x = int(input())
	div = int(x / 2)
	scndbag = 2 ** x
	for r in range(div - 1):
		scndbag += 2 ** (r + 1)
	for t in range(div - 1, x - 1):
		frstbag += 2 ** (t + 1)
	print(abs(frstbag - scndbag))


t = int(input())
for v in range(t):
	n = int(input())
	sumr = 0
	for i in range(1, n + 1):
		sumr += 1 << i
	count = 0
	req = n / 2
	i = 1
	temp = 0
	while True:
		temp += 1 << i
		count += 1
		if count == req:
			break
		temp += 1 << n - i + 1
		count += 1
		if count == req:
			break
		i += 1
	temp3 = 1 << n
	for i in range(1, n // 2):
		temp3 += 1 << i
	temp4 = sumr - temp3
	temp2 = sumr - temp
	print(min(abs(temp - temp2), abs(temp3 - temp4)))


a = []
for i in range(int(input())):
	a.append(2 ** ((int(input()) + 2) // 2) - 2)
for j in a:
	print(j)


import math
test = int(input())
k = 1
while k <= test:
	n = int(input())
	a = math.pow(2, n)
	b = 0
	count = 1
	i = 1
	for i in range(1, n):
		if count == n // 2:
			break
		else:
			a += math.pow(2, i)
			count += 1
	for j in range(i, n):
		b += math.pow(2, j)
	print(int(a - b))
	k += 1


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	sum1 = 1 << n
	sum2 = 0
	for i in range(1, n // 2):
		sum1 += 1 << i
	for i in range(n // 2, n):
		sum2 += 1 << i
	print(abs(sum1 - sum2))


for _ in range(int(input())):
	n = int(input())
	l = []
	for j in range(n):
		l.append(2 ** (j + 1))
	a = l[n - 1]
	b = l[n - 2]
	for i in range(n // 2 - 1):
		a += l[i]
		b += l[n // 2 - 1 + i]
	print(a - b)


for _ in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	l = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	a = a + l[-1]
	l.pop()
	for i in range(n // 2):
		y = l.pop()
		b = b + y
	while len(l) != 0:
		y = l.pop()
		a = a + y
	print(abs(a - b))


t = int(input())
left = []
right = []
arr = []
for _ in range(t):
	n = int(input())
	arr = [2 ** i for i in range(1, n + 1)]
	left = arr[:n // 2]
	right = arr[n // 2:]
	(left[len(left) - 1], right[len(right) - 1]) = (right[len(right) - 1], left[len(left) - 1])
	print(abs(sum(left) - sum(right)))


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2:
		print(2)
	else:
		total = (pow(2, n) - 1) * 2
		sumA = pow(2, n) + (pow(2, n // 2 - 1) - 1) * 2
		sumB = total - sumA
		print(sumA - sumB)


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		n = int(input())
		print(2 ** (n // 2 + 1) - 2)
	q = int(input())
	for _ in range(q):
		solve()
main()


def minus(n):
	(res1, res2) = (0, 0)
	half = int(n / 2)
	for i in range(1, half):
		res1 += 2 ** i
	for i in range(half, n):
		res2 += 2 ** i
	res1 += 2 ** n
	return res1 - res2
t = int(input())
for _ in range(t):
	n = int(input())
	print(minus(n))


t = int(input())
for q in range(t):
	n = int(input())
	(a, b) = (2 ** n, 0)
	x = 2
	for i in range(n // 2 - 1):
		a += x
		x *= 2
	for i in range(n // 2):
		b += x
		x *= 2
	print(a - b)


t = int(input())
for i in range(t):
	n = int(input())
	l = [2 ** j for j in range(1, n + 1)]
	a = sum(l[:n // 2 - 1]) + l[n - 1]
	b = sum(l[n // 2 - 1:n - 1])
	print(abs(a - b))


def fun():
	n = int(input(''))
	c = 0
	d = 0
	c = c + 2 ** n
	for i in range(1, n // 2):
		c = c + 2 ** i
	for i in range(n // 2, n):
		d = d + 2 ** i
	print(c - d)
n = int(input(''))
for i in range(n):
	fun()


for _ in range(int(input())):
	n = int(input())
	ans = 2 ** n
	for i in range(1, n):
		if i < n // 2:
			ans += 2 ** i
		else:
			ans -= 2 ** i
	print(abs(ans))


for i in range(int(input())):
	n = int(input())
	print(pow(2, n // 2 + 1) - 2)


t = int(input())
for i in range(1, t + 1):
	n = int(input())
	if n == 2:
		print(2)
	else:
		print(pow(2, n // 2 + 1) - 2)


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)

def inin():
	return int(input())

def inar():
	return list(map(int, input().split()))

def ar(element, size):
	return [element for i in range(size)]
for _ in range(int(input())):
	n = inin()
	a = 0
	b = 0
	for i in range(1, n + 1):
		if i < n // 2:
			a += 2 ** i
		elif i == n:
			a += 2 ** i
		else:
			b += 2 ** i
	print(abs(b - a))


n = int(input())
var = [0] * n
for x in range(0, n):
	var[x] = int(input())
for x in range(0, n):
	sum1 = 0
	sum2 = 0
	y = 0
	a = 0
	for i in range(1, int(var[x] / 2)):
		a = 2 ** int(var[x])
		sum1 += 2 ** i
	for j in range(int(var[x] / 2), int(var[x])):
		sum2 += 2 ** j
	y = sum1 + a
	print(abs(y - sum2))


i = int(input())
for _ in range(i):
	n = int(input())
	pile_a = 2 ** (n / 2) - 2 + 2 ** n
	pile_b = 2 ** (n + 1) - 2 - pile_a
	print(int(abs(pile_a - pile_b)))


import math
t = int(input())
for ii in range(t):
	n = int(input())
	ls = []
	for i in range(n):
		ls.append(2 ** (i + 1))
	if n == 2:
		print(abs(ls[0] - ls[1]))
	else:
		ans1 = ls[n - 1]
		ans2 = 0
		for i in range(n // 2 - 1):
			ans1 += ls[i]
		for i in range(n // 2 - 1, n - 1):
			ans2 += ls[i]
		print(abs(ans1 - ans2))


from collections import Counter, defaultdict, deque
import heapq as hq
import math
import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	a = 2 ** n
	for i in range(1, n // 2):
		a += 2 ** i
	diff = 2 ** (n + 1) - a - 2
	print(a - (2 ** (n + 1) - 2 - a))
tt = int(input())
for test in range(tt):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	l = 2 ** n + (2 ** int(n / 2) - 2)
	print(l - (2 * 2 ** n - 2 - l))


n = int(input())
for i in range(n):
	a = int(input())
	if a == 2:
		print('2')
	else:
		sum1 = 2 ** a
		sum2 = 0
		for j in range(1, a // 2):
			sum1 += 2 ** j
		for k in range(a // 2, a):
			sum2 += 2 ** k
		print(abs(sum1 - sum2))


li = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824]
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = li[0:n]
	half = n // 2
	ind = n - 1
	start = n - 1 - half
	dif = abs(sum(a[0:start]) + a[n - 1] - sum(a[start:n - 1]))
	print(dif)


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print('2')
	else:
		num = n // 2
		start = pow(2, num)
		sume = start
		for j in range(1, num):
			sume += start * 2
			start *= 2
		total = 1 << n + 1
		total -= 2
		total -= sume
		print(abs(total - sume))


def prob(n):
	pos = 2 ** n
	for i in range(1, n // 2):
		pos += 2 ** i
	for i in range(n // 2, n):
		pos -= 2 ** i
	return pos
inp = int(input())
for i in range(inp):
	case = int(input())
	print(prob(case))


n = int(input())
for i in range(n):
	x = int(input())
	l = []
	for j in range(1, x + 1):
		l.append(2 ** j)
	if x == 2:
		print(l[1] - l[0])
	elif x == 4:
		print(l[0] + l[3] - l[1] - l[2])
	else:
		s = l[-1]
		v = x // 2
		s1 = sum(l[v - 1:-1])
		s = s + sum(l[:v - 1])
		print(abs(s - s1))


def nod(a, b):
	while a != b:
		(a, b) = (max(a, b), min(a, b))
		if a % b == 0:
			a -= (a // b - 1) * b
		else:
			a -= a // b * b
	return a
a = [2 ** i for i in range(1, 31)]
for i in range(int(input())):
	n = int(input())
	print(a[n - 1] + sum(a[:n // 2 - 1]) - sum(a[n // 2 - 1:n - 1]))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	c = inp()
	for i in range(c):
		d = inp()
		r1 = 2 ** d
		r2 = 0
		for i in range(d - 1, d // 2 - 1, -1):
			r2 += 2 ** i
		for i in range(d // 2 - 1, 0, -1):
			r1 += 2 ** i
		print(abs(r1 - r2))
main()


for t in range(int(input())):
	n = int(input())
	sum_r = 2 ** n
	sum_l = 0
	ct = 0
	for i in range(n - 1, 0, -1):
		if sum_l < sum_r and ct < n // 2:
			sum_l += 2 ** i
			ct += 1
		else:
			sum_r += 2 ** i
	print(sum_r - sum_l)


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for i in range(1, n):
		l.append(pow(2, i))
	sum1 = 1 << n
	sum2 = 0
	for i in range(len(l) // 2):
		sum1 += l[i]
	for i in range(len(l) // 2, len(l)):
		sum2 += l[i]
	print(sum1 - sum2)


tc = int(input())
for i in range(tc):
	n = int(input())
	(suma, sumb, cnt) = (0, 1, 0)
	x = [i for i in range(1, n + 1)]
	while cnt < n:
		if suma < sumb:
			suma += 2 ** x[-1]
			x.pop(-1)
			cnt += 1
		else:
			suma += 2 ** x[0]
			x.pop(0)
			cnt += 1
		if sumb < suma:
			sumb += 2 ** x[-1]
			x.pop(-1)
			cnt += 1
		else:
			sumb += 2 ** x[0]
			x.pop(0)
			cnt += 1
	print(abs(suma - sumb + 1))


t = int(input())
coins = [int(input()) for x in range(t)]
weight = [[] for _ in range(t)]
for x in range(t):
	for y in range(1, coins[x] + 1):
		weight[x].append(2 ** y)
res = []
(sum1, sum2) = (0, 0)
for x in range(t):
	for y in range(coins[x]):
		if y < coins[x] / 2 - 1 or y == coins[x] - 1:
			sum1 += weight[x][y]
		else:
			sum2 += weight[x][y]
	print(abs(sum1 - sum2))
	(sum1, sum2) = (0, 0)


t = int(input())
for j in range(t):
	n = int(input())
	c = []
	for i in range(1, n + 1):
		c.append(2 ** i)
	k = sum(c[int(n / 2) - 1:n - 1])
	m = sum(c[0:int(n / 2) - 1]) + c[n - 1]
	print(m - k)


t = int(input())
lis = [0]
for i in range(1, 30 + 1):
	lis.append(2 ** i)
while t:
	n = int(input())
	part1 = lis[n]
	part2 = 0
	for i in range(1, int(n / 2)):
		part1 += lis[i]
	for i in range(int(n / 2), n):
		part2 += lis[i]
	print(abs(part1 - part2))
	t -= 1


for t in range(int(input())):
	n = int(input())
	sum = 2 ** (n + 1) - 2
	a = 2 ** (n // 2) - 2 + 2 ** n
	b = sum - a
	if b > a:
		print(b - a)
	else:
		print(a - b)


import sys
import heapq
import math
import bisect

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, input().split())

def rlinput():
	return list(map(int, input().split()))

def srlinput():
	return sorted(list(map(int, input().split())))

def main():
	n = iinput()
	q = [2]
	for i in range(n):
		q.append(q[-1] * 2)
	s = 0
	for i in range(n // 2 - 1):
		s += q[i]
	print(abs(sum(q) - q[-1] - s - s - q[-1]))
for sdfghjkl in range(iinput()):
	main()


for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(2)
	else:
		a = pow(2, n)
		b = 0
		x = n / 2
		y = n / 2
		for i in range(n - 1, 0, -1):
			if a < b:
				if x > 0:
					a += pow(2, i)
					x -= 1
				else:
					b += pow(2, i)
			elif y > 0:
				b += pow(2, i)
				y -= 1
			else:
				a += pow(2, i)
		print(abs(a - b))


from collections import Counter
import itertools
from functools import lru_cache
import sys
import math

def helper():
	pass

def solve():
	n = int(input())
	if n == 2:
		print(2)
	else:
		mid = 0
		for i in range(1, n // 2):
			mid += pow(2, i)
		mid += pow(2, n)
		total = 0
		for i in range(1, n + 1):
			total += pow(2, i)
		left = total - mid
		print(abs(mid - left))
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	arr = []
	half = 1
	leftsum = 0
	rightsum = 0
	for i in range(1, n + 1):
		if half <= n // 2 - 1:
			ans = 2 ** i
			leftsum = leftsum + ans
			half += 1
		else:
			ans = 2 ** i
			rightsum = rightsum + ans
			half += 1
	leftsum = leftsum + 2 ** n
	rightsum = rightsum - 2 ** n
	print(leftsum - rightsum)


t = int(input())
for _ in range(t):
	n = int(input())
	suma = 0
	sumb = 0
	for i in range(1, n):
		if i < n / 2:
			suma += 2 ** i
		else:
			sumb += 2 ** i
	suma += 2 ** n
	print(suma - sumb)


import math
t = int(input())
for i in range(0, t):
	n = int(input())
	if n == 2:
		print('2')
	else:
		a = 0
		b = 0
		firsthalf = math.floor((n - 1) / 2)
		for j in range(1, firsthalf + 1):
			a += 2 ** j
		a += 2 ** n
		for j in range(firsthalf + 1, n):
			b += 2 ** j
		print(abs(a - b))


c = int(input())
s = 0
while s < c:
	l = []
	a = []
	b = []
	values = int(input())
	for i in range(1, values + 1):
		v = 2 ** i
		l.append(v)
	for i in range(int(values / 2) - 1, values - 1):
		a.append(l[i])
	b = sum(l) - sum(a)
	print(abs(b - sum(a)))
	s += 1


for t in range(int(input())):
	n = int(input())
	p = n - 2
	l = []
	g = []
	l = [2 ** i for i in range(1, p // 2 + 1)]
	g = [2 ** r for r in range(p // 2 + 1, p + 1)]
	l.append(2 ** n)
	g.append(2 ** (n - 1))
	f = sum(g)
	h = sum(l)
	print(abs(f - h))


for i in range(int(input())):
	n = int(input())
	su = (1 << n + 1) - 2
	a = 1 << n
	for i in range(1, n // 2):
		a += 1 << i
	print(abs(a - (su - a)))


for _ in range(int(input())):
	n = int(input())
	l = [2 ** x for x in range(1, n + 1)]
	N = n // 2
	l1 = []
	if n == 2:
		l1.append(2)
	else:
		l1.append(l[n - 1])
		for i in range(N - 1):
			l1.append(l[i])
	sum1 = sum(l1)
	sum2 = sum(l) - sum1
	print(abs(sum2 - sum1))


for _ in range(int(input())):
	n = int(input())
	(p, m, k, s, t, x) = (0, 0, 0, 0, 0, 0)
	m = n // 2 - 1
	k = n // 2
	s = 2 ** n
	p = 2 ** m - 1
	p = 2 * p + s
	t = 2 ** k - 1
	x = 2 ** k
	x = x * t
	print(p - x)


for i in ' ' * int(input()):
	total = 0
	a = int(input()) // 2
	for x in range(1, a + 1):
		total += 2 ** x
	print(total)


for _ in range(int(input())):
	n = int(input())
	first = 2 ** n
	second = 0
	for i in range(1, n // 2):
		first += 2 ** i
	for j in range(n // 2, n):
		second += 2 ** j
	print(first - second)


tests = int(input())
wg = [2 ** i for i in range(31)]
for _ in range(tests):
	n = int(input())
	print(wg[n] + sum(wg[1:n // 2]) - sum(wg[n // 2:n]))


p = int(input())
for z in range(p):
	n = int(input())
	(a, b) = (0, 0)
	for i in range(1, n // 2):
		a += 2 ** i
	for i in range(n // 2, n):
		b += 2 ** i
	a += 2 ** n
	print(abs(a - b))


t = int(input())
q = [0] * t

def cal():
	n = int(input())
	k1 = n // 2
	k2 = k1
	s1 = 0
	s2 = 0
	coin = 2 ** n
	while k1 > 0 and k2 > 0:
		if s1 >= s2:
			s2 += coin
			k2 -= 1
		else:
			s1 += coin
			k1 -= 1
		coin = coin // 2
	bonus = 0
	while coin >= 2:
		bonus += coin
		coin = coin // 2
	if k1 > 0:
		s1 += bonus
	else:
		s2 += bonus
	bonus = abs(s1 - s2)
	return bonus
for i in range(t):
	q[i] = cal()
for i in range(t):
	print(q[i])


for i in range(int(input())):
	n = int(input())
	a = 2 ** (n // 2) - 2 + 2 ** n
	b = 2 ** n - 2 ** (n // 2)
	print(abs(a - b))


test_cases = int(input())
for test_case in range(test_cases):
	coins = int(input())
	total_coins = [2 ** x for x in range(1, coins)]
	half_size = coins // 2
	first_set = [2 ** coins]
	second_set = []
	for x in range(half_size - 1):
		first_set.append(total_coins[x])
	for y in range(half_size - 1, coins - 1):
		second_set.append(total_coins[y])
	diff = sum(first_set) - sum(second_set)
	print(diff)


import math as mt
import sys, string, bisect
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
t = I()
ans = 0
for j in range(t):
	ans = 0
	ans2 = 0
	n = I()
	for i in range(1, n // 2):
		ans += pow(2, i)
	ans += pow(2, n)
	for i in range(n // 2, n):
		ans2 += pow(2, i)
	print(abs(ans - ans2))


test_cases = int(input())
for i in range(test_cases):
	number = int(input())
	list = []
	for j in range(number):
		list.append(2 ** (j + 1))
	list_1 = list[0:len(list) // 2 - 1] + [list[-1]]
	list_2 = list[len(list) // 2 - 1:-1]
	print(sum(list_1) - sum(list_2))


def solve():
	n = int(input())
	return 2 ** (n // 2 + 1) - 2
for __ in range(int(input())):
	print(solve())


t = int(input())
for i in range(t):
	n = int(input())
	heavy = sum([2 ** j for j in range(1, n // 2)])
	heavy += 2 ** n
	light = sum([2 ** j for j in range(n // 2, n)])
	print(heavy - light)


z = int(input())
for u in range(z):
	pp = int(input())
	(a, b) = (0, 0)
	for i in range(1, pp + 1):
		if i <= pp // 2 - 1:
			a += pow(2, i)
		elif i >= pp // 2 and i <= pp - 1:
			b += pow(2, i)
		elif i == pp:
			a += pow(2, i)
	print(abs(a - b))


c = int(input())
for i in range(c):
	t = int(input())
	ans = pow(2, int(t // 2 + 1))
	ans -= 2
	print(ans)


t = int(input())
for test in range(t):
	n = int(input())
	count = 0
	for i in range(n // 2):
		count += 2 ** (i + 1)
	print(count)


t = int(input())
for t in range(t):
	p = int(input())
	x = y = 0
	for i in range(1, p + 1):
		if i < p // 2 or i == p:
			x += 2 ** i
		else:
			y += 2 ** i
	print(abs(x - y))


from collections import defaultdict, deque, Counter, OrderedDict
import math

def main():
	ans = [0 for i in range(0, 31)]
	ans[2] = 2
	for i in range(4, 31, 2):
		a = 2 ** i
		b = 0
		for j in range(1, int(i / 2)):
			a += 2 ** j
		for j in range(int(i / 2), i):
			b += 2 ** j
		ans[i] = a - b
	t = int(input())
	for i in range(t):
		n = int(input())
		print(ans[n])
main()


for i in range(int(input())):
	n = int(input())
	i = 8
	x = n // 2
	if n == 2:
		print(2)
	else:
		while x != 2:
			i = i * 2
			x = x - 1
		print(i - 2)


import sys
from math import log2, floor, ceil, sqrt
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(int(ri())):
	n = int(ri())
	a = []
	b = []
	turn = 0
	asu = 0
	bsu = 0
	half = n // 2
	for i in range(half - 1):
		asu += 2 ** (i + 1)
	asu += 2 ** n
	for i in range(half - 1, n - 1):
		bsu += 2 ** (i + 1)
	print(asu - bsu)


for _ in range(int(input())):
	nums = []
	n = int(input())
	for i in range(n):
		nums.append(2 ** (i + 1))
	big_sum = nums[-1] + sum(nums[0:n // 2 - 1])
	mid_sum = sum(nums) - big_sum
	print(abs(big_sum - mid_sum))


t = int(input())
for _ in range(t):
	n = int(input())
	sum_one = sum_two = 0
	sum_one += 2 ** n
	for i in range(1, n // 2):
		sum_one += 2 ** i
	for i in range(n // 2, n):
		sum_two += 2 ** i
	print(abs(sum_one - sum_two))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list()
	for i in range(1, n + 1):
		arr.append(2 ** i)
	pile1 = arr[-1]
	for k in range(0, int(n / 2) - 1):
		pile1 += arr[k]
	pile2 = 0
	for pile in range(int(n / 2) - 1, n - 1):
		pile2 += arr[pile]
	print(abs(pile1 - pile2))


for i in range(int(input())):
	coins = int(input())
	selected = range(1, coins // 2)
	first_pile = 2 ** coins + sum(list(map(lambda x: 2 ** x, selected)))
	second_pile = sum(list(map(lambda x: 2 ** x, range(coins // 2, coins))))
	print(abs(first_pile - second_pile))


z = int(input())
for h in range(z):
	n = int(input())
	x = 0
	y = 0
	for i in range(1, n + 1):
		if i < n // 2 or i == n:
			x += 2 ** i
		else:
			y += 2 ** i
	print(abs(x - y))


t = int(input())
while t > 0:
	n = int(input())
	l1 = []
	for i in range(1, n + 1):
		l1.append(2 ** i)
	l2 = [l1[n - 1]]
	l2 = l2 + l1[0:n // 2 - 1]
	l1 = l1[n // 2 - 1:n - 1]
	print(abs(sum(l1) - sum(l2)))
	t -= 1


n = int(input())
test = list()
for i in range(n):
	test.append(int(input()))
ks = list()
halflst = list()
for i in range(len(test)):
	if test[i] == 2:
		print(2)
	elif test[i] == 4:
		print(6)
	else:
		for i in range(1, test[i] + 1):
			ks.append(2 ** i)
		half = len(ks) / 2
		mn = ks.pop()
		halflst.append(mn)
		while len(ks) > half:
			mn = ks.pop(0)
			halflst.append(mn)
		diff = sum(ks) - sum(halflst)
		print(abs(diff))
		ks.clear()
		halflst.clear()


j = [int(input()) for i in range(int(input()))]
for elem in j:
	k = 0
	o = 0
	if elem > 2:
		k += 2 ** 1 + 2 ** elem
		for i in range(1, (elem - 2) // 2):
			k += 2 ** (1 + i)
		for i in range(elem // 2, elem):
			o += 2 ** i
		print(abs(k - o))
	else:
		print(2)


for _ in range(int(input())):
	n = int(input())
	cursum = 2 * (2 ** n - 1)
	t = n - 1
	s = 0
	for i in range(n // 2):
		s += 2 ** t
		t -= 1
	temp = cursum - s
	print(abs(temp - s))


from sys import *
from collections import defaultdict as dd
from math import *
from bisect import *

def sinp():
	return input()

def inp():
	return int(sinp())

def minp():
	return map(int, sinp().split())

def linp():
	return list(minp())

def strl():
	return list(sinp())

def pr(x):
	print(x)
mod = int(1000000000.0 + 7)
for _ in range(inp()):
	n = inp()
	ans = 2 ** n
	i = n - 1
	while i > 0:
		if i >= n // 2:
			ans -= 2 ** i
		else:
			ans += 2 ** i
		i -= 1
	pr(ans)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')

def main():
	for _ in range(N()):
		n = N()
		res = 2 ** n
		b = 0
		for i in range(n - 1, 0, -1):
			if b < n // 2:
				res -= 2 ** i
				b += 1
			else:
				res += 2 ** i
		print(res)
main()


def coins(n):
	a = 2 ** n
	b = 0
	start = a
	for i in range(int(n / 2)):
		start /= 2
		b += start
	for i in range(int(n / 2) - 1):
		start /= 2
		a += start
	return int(abs(a - b))
test = int(input())
for i in range(test):
	n = int(input())
	print(coins(n))


t = int(input())
for t1 in range(0, t):
	n = int(input())
	a = 0
	b = 0
	l = []
	for i in range(1, n + 1):
		l.append(pow(2, i))
	if n == 2:
		print(2)
	else:
		x = n // 2
		s = sum(l)
		a = l[-1]
		x = x - 1
		a = a + sum(l[:x])
		b = s - a
		print(abs(a - b))


for _ in range(int(input())):
	print(abs(2 ** (int(input()) // 2 + 1) - 2))


test_case = int(input())
while test_case > 0:
	N = int(input())
	temp = N // 2
	num = 2
	i = 4
	while temp > 1:
		num += i
		i *= 2
		temp -= 1
	print(num)
	test_case -= 1


p = [1]
for i in range(31):
	p.append(2 * p[-1])
TT = int(input())
while TT > 0:
	TT -= 1
	n = int(input())
	res = p[n]
	for k in range(1, n // 2):
		res += p[k]
	for k in range(n // 2, n):
		res -= p[k]
	print(res)


import getopt
import sys
import math
onlyCase = -1
verbose = False
try:
	(opts, args) = getopt.getopt(sys.argv[1:], 'vc:', ['case='])
except getopt.GetoptError as err:
	print(str(err))
	sys.exit(2)
for (o, a) in opts:
	if o in ('-c', '--case'):
		onlyCase = int(a)
	elif o == '-v':
		verbose = True
	else:
		sys.exit()
ncases = int(input())
for c in range(1, ncases + 1):
	N = int(input())
	if onlyCase != -1 and onlyCase != c:
		continue
	print('%d' % (2 ** (N / 2 + 1) - 2))


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	ntest = int(stdin.readline())
	for testcase in range(ntest):
		n = int(stdin.readline())
		(A, B) = ([0], [0])
		m = n // 2
		for i in range(n, 0, -1):
			s = 1 << i
			if sum(A) <= sum(B) and len(A) <= m or len(B) > m:
				A.append(s)
			else:
				B.append(s)
		stdout.write('%d\n' % abs(sum(A) - sum(B)))
	return 0
main()


for _ in range(int(input())):
	n = int(input())
	i = 0
	j = n - 1
	list1 = [2 ** i for i in range(1, n + 1)]
	(sum_a, sum_b) = (0, 0)
	sum_a = sum(list1[0:n // 2 - 1]) + list1[-1]
	sum_b = sum(list1[n // 2 - 1:-1])
	print(abs(sum_a - sum_b))


from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
sqrt = math.sqrt

def LI():
	return list(map(int, input().split()))

def LF():
	return list(map(float, input().split()))

def LI_():
	return list(map(lambda x: int(x) - 1, input().split()))

def II():
	return int(input())

def IF():
	return float(input())

def S():
	return input().rstrip()

def LS():
	return S().split()

def IR(n):
	return [II() for _ in range(n)]

def LIR(n):
	return [LI() for _ in range(n)]

def FR(n):
	return [IF() for _ in range(n)]

def LFR(n):
	return [LI() for _ in range(n)]

def LIR_(n):
	return [LI_() for _ in range(n)]

def SR(n):
	return [S() for _ in range(n)]

def LSR(n):
	return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

def solve():
	t = II()
	b = [0] + [pow(2, i) for i in range(1, 31)]
	b = list(itertools.accumulate(b))
	for i in range(t):
		n = II()
		print(abs(pow(2, n) + b[n // 2 - 1] - (b[n - 1] - b[n // 2 - 1])))
	return
solve()


t = int(input())
for _ in range(t):
	n = int(input())
	temp1 = 0
	temp2 = 0
	temp1 += 2 ** n
	for i in range(1, n // 2):
		temp1 += 2 ** i
	for i in range(n // 2, n):
		temp2 += 2 ** i
	print(temp1 - temp2)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		l = [2 ** i for i in range(1, n + 1)]
		a = sum(l[0:int(n / 2 - 1)]) + l[n - 1]
		b = sum(l[int(n / 2 - 1):n - 1])
		print(abs(a - b))


t = int(input())
if 1 <= t <= 100:
	for i in range(t):
		n = int(input())
		if n % 2 == 0:
			l = n / 2
			l = int(l)
			f = 0
			r = 2 ** n
			for k in range(1, l, 1):
				f += 2 ** k
			p = r + f
			q = r - 2 - f
			a = abs(p - q)
			print(a)


for t in [0] * int(input()):
	n = int(input())
	lst = [2 ** i for i in range(1, n + 1)]
	lst.sort(reverse=True)
	a = lst[1:n // 2 + 1]
	b = [lst[0]] + lst[n // 2 + 1:]
	print(abs(sum(a) - sum(b)))


for t in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	ar = []
	for i in range(1, n + 1):
		ar.append(2 ** i)
	b += ar[-1]
	j = n - 2 - n // 2
	for i in range(n - 2, j, -1):
		a += ar[i]
	for i in range(j, -1, -1):
		b += ar[i]
	print(abs(b - a))


li = [2]
x = 2
for i in range(30):
	x = x * 2
	li.append(x)
for _ in range(int(input())):
	n = int(input())
	c = 0
	for i in range(n // 2 - 1):
		c += li[i]
	d = 0
	c += li[n - 1]
	for i in range(n // 2 - 1, n - 1):
		d += li[i]
	print(abs(c - d))


import math
import cmath
from decimal import *
from fractions import *
t = int(input())
for _ in range(t):
	(n, res) = (int(input()), 0)
	for x in range(1, n // 2):
		res += 1 << x
	res += 1 << n
	for x in range(n // 2, n):
		res -= 1 << x
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	number = []
	for j in range(1, n + 1):
		number.append(2 ** j)
	divide = n // 2
	if divide == 1:
		a = number[1]
		b = number[0]
	else:
		a = sum(number[0:divide - 1]) + number[n - 1]
		b = sum(number[divide - 1:n - 1])
	print(abs(a - b))


t = int(input())
for i in range(t):
	n = int(input())
	nums = []
	for j in range(1, n + 1):
		nums.append(2 ** j)
	sum1 = nums[n - 1]
	sum2 = 0
	c = 0
	for j in range(int(n / 2) - 1):
		sum1 += nums[j]
		c += 1
	for j in range(c, n - 1):
		sum2 += nums[j]
	print(abs(sum1 - sum2))


t = int(input())
a = []
for i in range(t):
	n = int(input())
	sum1 = 0
	sum2 = 0
	if n % 2 == 0:
		for j in range(1, n + 1):
			c = 2 ** j
			a.append(c)
		sum1 = sum1 + a[-1]
		for k in range(int(len(a) / 2) - 1):
			sum1 = sum1 + a[k]
		for k in range(int(len(a) / 2) - 1, n - 1):
			sum2 = sum2 + a[k]
	a.clear()
	print(int(sum1 - sum2))


n = int(input())
s = 0
f = 0
for i in range(n):
	a = int(input())
	if a == 2:
		print(2)
	else:
		d = int(a / 2 - 1)
		for j in range(1, d + 1):
			s = s + 2 ** j
		for k in range(1, a):
			f = f + 2 ** k
		print(abs(2 * s + 2 ** a - f))
		f = 0
		s = 0


n = int(input())
a = []
for i in range(0, n):
	a.append(int(input()))
for i in range(0, n):
	val = []
	for j in range(1, a[i] + 1):
		val.append(2 ** j)
	temp = val[a[i] - 1]
	val.insert(0, temp)
	val.pop()
	n1 = 0
	n2 = 0
	for j in range(0, a[i] // 2):
		n1 += val[j]
		n2 += val[a[i] - 1 - j]
	diff = abs(n1 - n2)
	print(diff)


t = int(input())
for _ in range(t):
	n_2 = [2 ** (i + 1) for i in range(int(input()))]
	a = n_2[-1] + sum(n_2[:len(n_2) // 2 - 1])
	b = sum(n_2) - a
	print(a - b)


z = int(input())
l = []
for x in range(z):
	n = int(input())
	for y in range(1, n + 1):
		l.append(2 ** y)
	j = int(n / 2) - 1
	s = l[n - 1:] + l[:j]
	k = l[j:n - 1]
	print(sum(s) - sum(k))
	l = []


for i in range(int(input())):
	n = int(input())
	ans = 2 ** n
	ch = 0
	for j in range(n - 1, 0, -1):
		if ch < n // 2:
			ans -= 2 ** j
			ch += 1
		else:
			ans += 2 ** j
	print(ans)


def rd(n):
	if n == 0:
		return input('')
	if n == 1:
		return int(input())
	if n == 2:
		return map(int, input().split())
	if n == 3:
		return list(map(int, input().split()))

def solve():
	t = rd(1)
	for _ in range(t):
		n = rd(1)
		a = 0
		b = 0
		for i in range(1, n // 2):
			a += 2 ** i
		a += 2 ** n
		for i in range(n // 2, n):
			b += 2 ** i
		print(abs(b - a))
solve()


l = [0 for i in range(31)]
d = 2
for i in range(2, 31):
	if i % 2 == 0:
		l[i] = l[i - 2] + d
		d = 2 * d
n = int(input())
for i in range(n):
	num = int(input())
	print(l[num])


c = int(input())
r = []
while c > 0:
	n = int(input())
	x = n / 2
	b = 2 ** n
	a = 2 ** (n / 2)
	while x > 1:
		b = b + 2 ** (x - 1)
		a = a + 2 ** (-x + n + 1)
		x -= 1
	c -= 1
	r.append(int(abs(a - b)))
z = len(r)
while z > 0:
	print(f'{r[0]}')
	r.remove(r[0])
	z -= 1


t = int(input())
while t:
	t -= 1
	n = int(input())
	x = []
	ans = 0
	for i in range(1, n + 1):
		x.append(2 ** i)
	for i in range(n // 2):
		ans += x[i]
		ans += x[-i]
	print(abs(sum(x) - ans))


def solve(val):
	(a, b) = (2 ** val, 0)
	for i in range(val):
		if i < val / 2:
			a += 2 ** i
		else:
			b += 2 ** i
	print(abs(a - b - 1))
t = int(input())
s = []
for i in range(t):
	s.append(int(input()))
for i in range(len(s)):
	solve(s[i])


for t in range(int(input())):
	n = int(input())
	l = []
	for i in range(0, n):
		l.append(2 * pow(2, i))
	s = sum(l[int(n / 2) - 1:n - 1])
	print(abs(sum(l) - s - s))


def solve():
	n = int(input())
	s = 0
	t = 0
	for i in range(1, n // 2):
		s += pow(2, i)
	for i in range(n // 2, n):
		t += pow(2, i)
	print(pow(2, n) + s - t)
t = int(input())
while t:
	t -= 1
	solve()


t = int(input())
for i in range(t):
	a = 0
	n = int(input())
	l = []
	z = 2
	for j in range(n):
		l.append(z)
		z = z * 2
	a = a + max(l)
	l.remove(max(l))
	for j in range(n // 2 - 1):
		a = a + l[j]
	for j in range(n // 2 - 1, n - 1):
		a = a - l[j]
	print(a)


n = int(input())
while n > 0:
	n = n - 1
	m = int(input())
	l = []
	mn = float('inf')
	for i in range(1, m + 1):
		l.append(2 ** i)
	for j in range(m // 2):
		mn = min(mn, abs(2 * sum(l[j:j + m // 2]) - sum(l)))
	print(mn)


def main():
	n = int(input())
	a = [2 ** i for i in range(1, n + 1)]
	a.reverse()
	bal = 0
	x1 = 0
	x2 = 0
	for i in a:
		if bal >= 0:
			if x1 >= n / 2:
				bal += i
				x2 += 1
			else:
				bal -= i
				x1 += 1
		elif x2 >= n / 2:
			bal -= i
			x1 += 1
		else:
			bal += i
			x2 += 1
	print(abs(bal))
t = int(input())
for i in range(t):
	main()


t = int(input(''))
for i in range(t):
	n = int(input(''))
	a = []
	for i in range(1, n):
		a.append(2 ** i)
	sum1 = a[len(a) - 1]
	for i in range(n // 2 - 1):
		sum1 += a[i]
	total = sum(a)
	sum2 = total - sum1
	print(sum1 - sum2)


import math
t = int(input())
for i in range(1, t + 1):
	n = int(input())
	minm = 10000000000
	j = int(n / 2) - 1
	sum1 = 0
	sum2 = 0
	for l in range(1, j + 1):
		sum1 = sum1 + pow(2, l)
	sum1 = sum1 + pow(2, n)
	for l in range(j + 1, n):
		sum2 = sum2 + pow(2, l)
	if n == 2:
		print(2)
	elif n == 4:
		print(6)
	else:
		print(abs(sum1 - sum2))


from math import *

def main():
	for _ in range(int(input())):
		n = int(input())
		s1 = 0
		s2 = 0
		for i in range(1, n // 2):
			s1 += pow(2, i)
		s1 += pow(2, n)
		for i in range(n // 2, n):
			s2 += pow(2, i)
		print(int(abs(s1 - s2)))
main()


t = int(input())
for i in range(t):
	coins = list()
	n = int(input())
	for j in range(1, n + 1):
		coins.append(2 ** j)
	coins.sort(reverse=True)
	a = list()
	b = list()
	for k in range(n):
		if k == 0:
			a.append(coins[k])
		elif k > n / 2:
			a.append(coins[k])
		else:
			b.append(coins[k])
	mindiff = abs(sum(a) - sum(b))
	print(mindiff)


t = int(input())
for xy in range(t):
	a = int(input())
	lx = 2 ** a
	tx = 2 ** (a - 1)
	for ap in range(1, a // 2):
		lx += 2 ** ap
	for qa in range(a // 2, a - 1):
		tx += 2 ** qa
	print(abs(lx - tx))


c = []
for i in range(int(input())):
	a = [2 ** (x + 1) for x in range(int(input()))]
	b = []
	i = len(a) // 2 - 1
	for j in range(len(a) // 2):
		b.append(a[i])
		i = i + 1
	a = list(set(a) - set(b))
	c.append(sum(a) - sum(b))
for i in c:
	print(i)


def oki(n):
	a = 2 ** n
	b = 2 ** (n - 1)
	for i in range(1, n // 2):
		a += 2 ** i
		b += 2 ** (n - 1 - i)
	print(abs(a - b))
for _ in range(int(input())):
	n = int(input())
	oki(n)


import math
t = int(input())
for i in range(t):
	n = int(input())
	sum = math.pow(2, n)
	for j in range(1, n // 2):
		sum += math.pow(2, j)
	for j in range(n // 2, n):
		sum -= math.pow(2, j)
	print(int(sum))


test_case = int(input())
for i in range(test_case):
	n = int(input())
	l = 2 ** n + (2 ** (n // 2) - 2)
	r = 2 ** (n + 1) - 2
	r = abs(l - r)
	print(abs(l - r))


t = int(input())
while t > 0:
	n = int(input())
	k = n // 2 - 1
	sum1 = 2 * (2 ** k - 1) + 2 ** n
	sum2 = 2 ** (k + 1) * (2 ** (k + 1) - 1)
	print(abs(sum2 - sum1))
	t -= 1


a = int(input())
for i in range(0, a):
	b = int(input())
	print(2 * pow(2, b // 2) - 2)


for _ in range(int(input())):
	n = int(input())
	A = [2 ** i for i in range(1, n + 1)]
	a = A.pop()
	b = A.pop()
	while A:
		a += A.pop(0)
		b += A.pop()
	print(a - b)


def shovel(n):
	sum1 = 0
	c1 = 0
	sum2 = 0
	c2 = 0
	for i in range(n, 0, -1):
		if sum1 == min(sum1, sum2) and c1 < n // 2 or c2 == n // 2:
			sum1 += 2 ** i
			c1 += 1
		elif sum2 == min(sum1, sum2) and c2 < n // 2 or c1 == n // 2:
			sum2 += 2 ** i
			c2 += 1
	return abs(sum1 - sum2)
for t in range(int(input())):
	n = int(input())
	print(shovel(n))


def solve():
	t = int(input())
	for i in range(t):
		n = int(input())
		m = [2 ** s for s in range(1, n + 1)]
		m[-1] = -m[-1]
		for j in range(n // 2 - 1):
			m[j] = -m[j]
		print(abs(sum(m)))
solve()


def solve(n, ans):
	arr = []
	for i in range(1, n + 1):
		arr.append(2 ** i)
	first = 0
	first += arr.pop()
	count = 1
	while count != n // 2:
		first += arr.pop(0)
		count += 1
	second = sum(arr)
	ans.append(abs(first - second))

def main():
	t = int(input())
	ans = []
	for i in range(t):
		n = int(input())
		solve(n, ans)
	for i in ans:
		print(i)
main()


for _ in range(int(input())):
	N = int(input())
	Answers = []
	for i in range(1, N + 1):
		Answers.append(2 ** i)
	(a, b) = (0, 0)
	a = Answers[-1] + sum(Answers[:N // 2 - 1])
	b = sum(Answers) - a
	print(max(a, b) - min(a, b))


n = int(input())
for i in range(n):
	x = int(input())
	arr = []
	max1 = []
	min1 = []
	mas = mis = 0
	for i in range(x):
		arr.append(2 ** (i + 1))
	l = arr[x - 1]
	max1.append(l)
	for i in range(int(x / 2)):
		max1.append(arr[i])
		min1.append(arr[x - i - 2])
	max1.pop()
	for i in range(len(max1)):
		mas = mas + max1[i]
		mis = mis + min1[i]
	print(mas - mis)


for t in range(int(input())):
	a = []
	x = 0
	y = 0
	n = int(input())
	for j in range(1, n + 1):
		a.append(2 ** j)
	d = len(a) // 2
	x = a[len(a) - 1]
	for k in range(d - 1):
		x = x + a[k]
	for l in range(d - 1, len(a) - 1):
		y = y + a[l]
	print(abs(x - y))


for p in range(int(input())):
	n = int(input())
	if n == 2:
		print(2)
	else:
		x = 2 * (2 ** n - 1 - (2 ** (n // 2 - 1) - 1)) - 2 ** n
		y = 2 * (2 ** (n // 2 - 1) - 1) + 2 ** n
		print(abs(x - y))


for _ in range(int(input())):
	print((1 << (int(input()) >> 1)) - 1 << 1)


t = int(input())
arr = []
for i in range(1, 31):
	arr.append(2 ** i)
for _ in range(t):
	n = int(input())
	print(arr[n - 1] + sum(arr[:n // 2 - 1]) - sum(arr[n // 2 - 1:n - 1]))


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
import bisect as bi
import heapq

def I():
	return int(input())

def In():
	return map(int, input().split())

def main():
	try:
		n = I()
		(s1, s2) = (d[n - 1], 0)
		t = n // 2
		i = n - 1
		while t > 0:
			i -= 1
			s2 += d[i]
			t -= 1
		for i in range(n // 2 - 1):
			s1 += d[i]
		print(abs(s1 - s2))
	except:
		pass
M = 998244353
P = 1000000007
d = []
for i in range(1, 31):
	d.append(2 ** i)
for _ in range(I()):
	main()


import sys
input = sys.stdin.readline
from collections import defaultdict as dd, deque as dq
import bisect
t = int(input())
while t:
	n = int(input())
	su1 = 0
	su2 = 0
	i = 1
	j = n
	for i in range(1, n // 2):
		su1 += 2 ** i
	su1 += 2 ** n
	for i in range(n // 2, n):
		su2 += 2 ** i
	print
	print(abs(su1 - su2))
	t -= 1


l = [0 for i in range(31)]
j = 2
k = 2
for i in range(2, 31, 2):
	l[i] = j
	j += pow(2, k)
	k += 1
t = int(input())
for _ in range(t):
	n = int(input())
	print(l[n])


for _ in range(int(input())):
	n = int(input())
	coins = [2 ** i for i in range(1, n + 1)]
	print(coins[-1] + sum(coins[:n // 2 - 1]) - sum(coins[n // 2 - 1:len(coins) - 1]))


t = int(input())
for i in range(t):
	ar = int(input())
	a = []
	for k in range(1, ar + 1):
		a.append(2 ** k)
	n = len(a)
	m = n // 2
	sum = a[n - 1]
	sum1 = 0
	for j in range(m - 1):
		sum = sum + a[j]
	for l in range(m - 1, n - 1):
		sum1 = sum1 + a[l]
	print(sum - sum1)


def compute(n):
	arr = [2 ** i for i in range(1, n + 1)]
	(a, b) = (0, 0)
	for i in range(n // 2 - 1):
		a += arr[i]
	if n != 2:
		a += arr[-1]
	for i in range(n // 2 - 1, n - 1):
		b += arr[i]
	return abs(a - b)
t = int(input())
for _ in range(t):
	n = int(input())
	print(compute(n))


t = int(input())

def solve(n):
	p1 = 2 ** n
	p2 = 0
	for i in range(1, n // 2):
		p1 += 2 ** i
	for i in range(n // 2, n):
		p2 += 2 ** i
	return abs(p1 - p2)
for _ in range(t):
	n = int(input())
	print(solve(n))


T = int(input())
for _ in range(T):
	n = int(input())
	if n == 2:
		print(2)
	else:
		group1 = 0
		group2 = 0
		tmp = 2
		for i in range(n // 2 - 1):
			group1 += tmp
			tmp <<= 1
		for i in range(n // 2):
			group2 += tmp
			tmp <<= 1
		group1 += tmp
		print(group1 - group2)


for _ in range(int(input())):
	n = int(input())
	if n == 0:
		print(0)
		continue
	if n == 2:
		print(2)
		continue
	pile1 = 1 << n
	pile2 = 0
	l = n // 2
	for i in range(1, l):
		pile1 = pile1 + (1 << i)
	for i in range(l, n):
		pile2 = pile2 + (1 << i)
	print(abs(pile1 - pile2))


for _ in range(int(input())):
	n = int(input())
	a = [2]
	for i in range(1, n):
		a.append(a[-1] * 2)
	k = n // 2 - 1
	ans = a[-1]
	ku = sum(a)
	for i in range(k):
		ans += a[i]
	print(abs(ku - ans - ans))


from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	n = int(input())
	res = 0
	a = []
	for i in range(1, n + 1):
		a.append(2 ** i)
	res = a[n - 1]
	for i in range(n // 2 - 1):
		res += a[i]
	for i in range(n // 2 - 1, n - 1):
		res -= a[i]
	print(abs(res))


for _ in range(int(input())):
	n = int(input())
	x1 = 0
	x2 = 0
	for i in range(1, n // 2):
		x1 += 2 ** i
	for j in range(n // 2, n):
		x2 += 2 ** j
	x1 += 2 ** n
	print(abs(x1 - x2))


t = int(input())
temp = []
first = []
second = []
pivot = 0
rpta = []
for i in range(t):
	n = int(input())
	for j in range(1, n + 1):
		temp.append(2 ** j)
	pivot = n // 2 - 1
	for aaa in range(pivot):
		first.append(temp[aaa])
	for aaa in range(pivot, pivot * 2 + 1):
		second.append(temp[aaa])
	first.append(temp[-1])
	rpta.append(abs(sum(first) - sum(second)))
	first = []
	second = []
	temp = []
for final in rpta:
	print(final)


test_case = int(input())
while test_case:
	n = int(input())
	print((1 << n // 2 + 1) - 2)
	test_case -= 1


n = int(input())
for i in range(n):
	m = int(input())
	x = 0
	y = 0
	for j in range(1, m // 2):
		x += 2 ** j
	for k in range(m // 2, m):
		y += 2 ** k
	print(abs(x + 2 ** m - y))


t = int(input())
for i in range(t):
	n = int(input())
	l = 0
	r = 0
	for i in range(1, n + 1):
		if i < int(n / 2) or i == n:
			r += 2 ** i
		else:
			l += 2 ** i
	print(r - l)


n = int(input())
for i in range(n):
	m = int(input())
	r = [2 ** j for j in range(1, m + 1)]
	print(r[-1] + sum(r[:len(r) // 2 - 1]) - sum(r[len(r) // 2 - 1:-1]))


def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))

def solve():
	n = ri()
	larger = pow(2, n) + sum([pow(2, i) for i in range(1, n // 2)])
	print(2 * (larger - pow(2, n) + 1))
t = ri()
for i in range(t):
	solve()


a = []
summ = 1
for i in range(31):
	summ *= 2
	a.append(summ)
for _ in range(int(input())):
	n = int(input())
	print(a[n - 1] + sum(a[:n // 2 - 1]) - sum(a[n // 2 - 1:n - 1]))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	s = 2 * (pow(2, n) - 1)
	s1 = pow(2, n)
	s -= s1
	n = n / 2 - 1
	while n > 0:
		s1 += pow(2, n)
		s -= pow(2, n)
		n -= 1
	print(abs(int(s - s1)))


def s(a):
	x = y = 0
	x += 1 << a
	for i in range(1, a // 2):
		x += 1 << i
	for i in range(a // 2, a):
		y += 1 << i
	return x - y
n = int(input())
for i in range(n):
	a = int(input())
	print(s(a))


import sys, bisect
from math import gcd
input = sys.stdin.readline

def inp():
	return int(input().rstrip())

def inlt():
	return list(map(int, input().rstrip().split()))

def insr():
	s = input().rstrip()
	return s[:len(s) - 1]

def invr():
	return map(int, input().rstrip().split())
times = 60
t = inp()
for _ in range(t):
	n = inp()
	nums = []
	s = 1
	mid = n // 2
	for i in range(n):
		s *= 2
		nums.append(s)
	first = 0
	last = n - 1
	ans = 0
	while first < mid - 1:
		ans += nums[first]
		first += 1
	ans += nums[n - 1]
	ans2 = 0
	while first < n - 1:
		ans2 += nums[first]
		first += 1
	print(abs(ans - ans2))


t = int(input())
for i in range(t):
	n = int(input())
	s1 = 2 ** n + 2 ** (n // 2) - 2
	s2 = 2 ** n - 2 ** (n // 2)
	print(s1 - s2)


test = int(input())
while test:
	test -= 1
	n = int(input())
	s1 = 0
	s2 = 0
	x = n // 2
	ls = []
	for i in range(1, n + 1):
		ls.append(2 ** i)
	c = 0
	for i in range(n - 2, -1, -1):
		s2 += ls[i]
		c += 1
		if c >= n // 2:
			break
	c -= 1
	s1 += ls[-1]
	for i in range(c):
		s1 += ls[i]
	print(abs(s1 - s2))


T = int(input())
for i in range(T):
	n = float(input())
	e = n / 2
	c = 2 * (2 ** e - 1)
	print(int(c))


t = int(input())
for _ in range(t):
	n = int(input())
	m = n // 2
	(sum1, sum2) = (0, 0)
	i = 1
	l = list(range(1, n + 1))
	sum1 += 2 ** n
	sum1 += 2 * (2 ** (m - 1) - 1)
	sum2 = 2 ** (n + 1) - 2 - sum1
	print(abs(sum2 - sum1))


for i in range(int(input())):
	n = int(input())
	arr = []
	for i in range(1, 1 + n):
		arr.append(2 ** i)
	first = arr[-1]
	second = arr[-2]
	arr = arr[:-2]
	for i in range(len(arr) // 2):
		if first >= second:
			second += arr[-1]
			first += arr[0]
			arr = arr[1:-1]
		else:
			first += arr[-1]
			second += arr[0]
			arr = arr[1:-1]
	print(abs(first - second))


t = int(input())
x = []
for i in range(t):
	n = int(input())
	a = [2 ** j for j in range(1, n + 1)]
	a1 = []
	for i in range(int(n - 2 - n / 2 + 1), n - 1):
		a1.append(a[i])
	a1 = sum(a1)
	a2 = a[-1] + sum(a[0:int(n - 2 - n / 2 + 1)])
	x.append(a2 - a1)
for i in x:
	print(i)


t = int(input())
for _ in range(t):
	n = int(input())
	group1 = 0
	group2 = 0
	if n == 2:
		print(2)
	else:
		for i in range(int(n / 2) - 1):
			group1 += 2 ** (i + 1)
		group1 += 2 ** n
		for i in range(int(n / 2) - 1, n - 1):
			group2 += 2 ** (i + 1)
		print(group1 - group2)


def fb(n):
	return int(2 ** n + 2 ** (n / 2) - 2)

def fa(n):
	return int(2 ** (n + 1) - 2 - fb(n))
t = int(input())
for i in range(t):
	a = int(input())
	print(abs(fa(a) - fb(a)))


t = int(input())
for i in range(t):
	n = int(input())
	x = n // 2
	a = []
	for i in range(1, n + 1):
		a.append(2 ** i)
	ans1 = a[len(a) - 1] + sum(a[:x - 1])
	ans2 = sum(a[x - 1:len(a) - 1])
	print(abs(ans1 - ans2))


for _ in range(int(input())):
	x = int(input())
	c = 0
	for i in range(1, x // 2):
		c += 2 ** i
	for j in range(x // 2, x):
		c -= 2 ** j
	print(2 ** x + c)


t = int(input())
for t1 in range(t):
	n = int(input())
	l1 = []
	l2 = []
	if n == 2:
		print(2)
		continue
	l1.append(pow(2, n))
	for i in range(1, n):
		if len(l1) < n // 2:
			l1.append(pow(2, i))
		else:
			l2.append(pow(2, i))
	print(abs(sum(l1) - sum(l2)))


from sys import stdin, stdout

def main():
	for _ in range(int(input())):
		n = int(input())
		sm1 = 2 ** n
		for i in range(1, n // 2):
			sm1 += 2 ** i
		sm2 = 0
		for i in range(n // 2, n):
			sm2 += 2 ** i
		print(abs(sm1 - sm2))
main()


for _ in range(int(input())):
	n = int(input())
	(s, p) = (0, 1)
	while p <= n:
		s += 2 ** p
		p += 1
	(p, f, c) = (n // 2, 0, 1)
	while c <= n // 2:
		f += 2 ** p
		p += 1
		c += 1
	print(abs(f - (s - f)))


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for _ in range(t):
		n = int(stdin.readline())
		(a, b) = (0, 0)
		k = n // 2
		for x in range(1, n + 1):
			if x < k or x == n:
				a += 2 ** x
			else:
				b += 2 ** x
		print(abs(a - b))
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	b = []
	a.append(pow(2, n))
	(s1, s2) = (0, 0)
	for i in range(n - 1):
		if len(a) < n / 2:
			a.append(pow(2, i + 1))
		else:
			b.append(pow(2, i + 1))
	for i in range(int(n / 2)):
		s1 += a[i]
		s2 += b[i]
	print(abs(s1 - s2))


t = int(input())
for _ in range(t):
	n = int(input())
	x = pow(2, n + 1) - 2
	a = pow(2, n)
	s = n // 2
	for i in range(1, s, 1):
		a += pow(2, i)
	h = x - a
	print(abs(h - a))


def f(n):
	s = 0
	for i in range(1, n // 2):
		s += 2 ** i
	return 2 * s + 2
T = int(input())
while T > 0:
	n = int(input())
	print(f(n))
	T -= 1


def new(n):
	ans = 1 << n + 1
	return ans - 2
for xx in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	print(new(n // 2))


def balance(n):
	sum1 = 2 ** n
	sum2 = 0
	for i in range(1, int(n / 2)):
		sum1 += 2 ** i
	for i in range(int(n / 2), n):
		sum2 += 2 ** i
	return sum1 - sum2
t = int(input())
for i in range(t):
	x = int(input())
	print(balance(x))


def difference(n):
	left = pow(2, n)
	mid = int(n / 2)
	for i in range(1, mid):
		left = left + pow(2, i)
	right = 0
	for i in range(mid, n):
		right = right + pow(2, i)
	return left - right
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
for x in a:
	print(difference(x))


t = int(input())
while t > 0:
	n = int(input())
	a = 2 ** n
	m = n // 2
	a += 2 ** m - 2
	b = 2 ** (n + 1) - 2 - a
	print(a - b)
	t -= 1


import math
for i in range(int(input())):
	coins = int(input())
	l = []
	for j in range(1, coins + 1):
		l.append(2 ** j)
	m = coins // 2
	sum1 = 0
	sum2 = 0
	l1 = []
	l2 = []
	if coins == 2:
		print(abs(l[0] - l[1]))
	else:
		sum1 = l[-1] + sum(l[:m - 1])
		sum2 = sum(l[m - 1:-1])
		print(abs(sum1 - sum2))


t = int(input())
while t > 0:
	n = int(input())
	l = []
	r = n // 2
	for i in range(1, n + 1):
		f = 2 ** i
		l.append(f)
	s = 0
	for j in range(0, r - 1):
		s += l[j]
	h = s + l[n - 1]
	g = 0
	for k in range(r - 1, n - 1):
		g += l[k]
	print(h - g)
	t -= 1


p = []
for i in range(1, 32):
	p.append(2 ** i)
t = int(input())
for _ in range(t):
	n = int(input())
	pick = n // 2
	s1 = 0
	if pick == 1:
		s1 = 2
	elif pick == 2:
		s1 = 18
	else:
		s1 = 2 + p[n - 1]
		for i in range(1, pick - 1):
			s1 += p[i]
	print(abs(sum(p[:n]) - s1 - s1))


for j in range(int(input())):
	lst = []
	n = int(input())
	for i in range(n):
		lst.append(2 ** (i + 1))
	ind = int(n / 2 - 1)
	print(sum(lst[0:ind]) + 2 ** n - sum(lst[ind:-1]))


import math
n = int(input())
while n != 0:
	l1 = []
	x = int(input())
	while x != 0:
		l1.append(2 ** x)
		x = x - 1
	sum1 = 0
	sum2 = 0
	sum1 = sum1 + l1[0]
	sum2 = sum2 + l1[1]
	l1.pop(0)
	l1.pop(0)
	n1 = math.floor(len(l1) / 2)
	s2 = sum(l1[0:n1])
	s1 = sum(l1[n1:len(l1)])
	sum1 = sum1 + s1
	sum2 = sum2 + s2
	print(sum1 - sum2)
	n = n - 1


t = int(input())
while t:
	n = int(input())
	if n == 2:
		print(2)
	else:
		dp = [0] * n
		dp[0] = 2
		for i in range(1, n):
			dp[i] = dp[i - 1] * 2
		a = dp[-1]
		b = 0
		count = 0
		i = n - 2
		while count < n // 2:
			b += dp[i]
			i -= 1
			count += 1
		i = 0
		while i < n // 2 - 1:
			a += dp[i]
			i += 1
		print(abs(a - b))
	t -= 1


def Function():
	n = int(input())
	if n == 2:
		print('2')
		return
	else:
		a = 2 ** n + sum([2 ** j for j in range(1, n // 2)])
		b = sum([2 ** j for j in range(n // 2, n)])
		print(abs(a - b))
for i in range(int(input())):
	Function()


d = {}
d[0] = 1

def powerr(x, y):
	if y in d:
		return d[y]
	temp = powerr(x, int(y / 2))
	if y % 2 == 0:
		d[y] = temp * temp
		return d[y]
	elif y > 0:
		d[y] = x * temp * temp
		return d[y]
	else:
		d[y] = temp * temp / x
		return d[y]
for _ in range(int(input())):
	n = int(input())
	total = powerr(2, n + 1) - 2
	half_sum1 = 0
	half_sum2 = 0
	for i in range(n // 2, n):
		half_sum1 += powerr(2, i)
	half_sum2 = total - half_sum1
	ans = half_sum2 - half_sum1
	print(ans)


def solve():
	n = int(input())
	a = (1 << n) + (1 << n // 2) - 2
	b = (1 << n + 1) - 2 - a
	print(a - b)
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	lst = []
	for j in range(1, n + 1):
		lst.append(2 ** j)
	res = lst[-1] + sum(lst[:n // 2 - 1]) - sum(lst[n // 2 - 1:-1])
	print(res)


t = int(input())
while t > 0:
	n = int(input())
	m = n / 2
	s1 = 0
	s2 = 0
	for i in range(1, n + 1):
		if i < m:
			s1 = s1 + 2 ** i
		else:
			s2 = s2 + 2 ** i
	s1 = s1 + 2 ** n
	s2 = s2 - 2 ** n
	ans = abs(s1 - s2)
	print(ans)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	dp = [[-1 for _ in range(n)] for _ in range(n)]

	def find(left, right, score):
		if left + right == n:
			if left == right:
				return abs(score)
			return 10 ** 10
		if dp[left][right] != -1:
			return dp[left][right]
		power = left + right + 1
		dp[left][right] = min(find(left + 1, right, score + 2 ** power), find(left, right + 1, score - 2 ** power))
		return dp[left][right]
	print(find(0, 0, 0))


for ii in range(int(input())):
	n = int(input())
	print(2 ** (int(n / 2) + 1) - 2)


for _ in range(int(input())):
	n = int(input())
	s1 = 0
	s2 = 0
	l = []
	s = 2 * (2 ** n - 1)
	if n == 2:
		print(2)
	else:
		for i in range(1, n + 1):
			l.append(2 ** i)
		s1 = l[-1] + sum(l[:n // 2 - 1])
		print(abs(s - s1 - s1))


t = int(input())
for i in range(t):
	M = []
	n = int(input())
	for x in range(n):
		M.append(2 ** (x + 1))
	a = M[-1]
	b = 0
	for x in range(int(n / 2) - 1):
		a += M[x]
	for x in range(n - 2, int(n / 2) - 2, -1):
		b += M[x]
	print(abs(a - b))


cases = int(input())
listn = []
list = []
list2 = []
base = int(2)
aprovacion = False
sub_b = 0
sub_a = 0
for i in range(cases):
	n = int(input())
	if n % 2 != 0:
		break
	listn.append(n)
for i in listn:
	for j in range(1, i + 1):
		potencia = base ** j
		list.append(potencia)
	cont = 0
	mitad = int(i / 2)
	aprovacion = False
	while aprovacion == False:
		a = 0
		b = 0
		x = list[0]
		for k in range(0, mitad):
			sub_a = list[k]
			a = a + sub_a
		for k2 in range(mitad, i):
			sub_b = list[k2]
			b = b + sub_b
		minimo = a - b
		if minimo < 0:
			minimo = minimo * -1
		list2.append(minimo)
		for m in range(i):
			if m != i - 1:
				list[m] = list[m + 1]
			else:
				list[i - 1] = x
		if cont == i - 1:
			aprovacion = True
		cont = cont + 1
	for e in range(i - 1):
		if list2[e] < list2[e + 1]:
			ordn = list2[e]
			list2[e] = list2[e + 1]
			list2[e + 1] = ordn
	print(list2[-1])
	list = []
	list2 = []


for _ in range(int(input())):
	t = int(input())
	l = [int(2 ** x) for x in range(1, t + 1)]
	k = t // 2
	k = k - 1
	l1 = []
	l2 = []
	for i in range(t):
		if i < k or i == t - 1:
			l1.append(l[i])
		else:
			l2.append(l[i])
	print(sum(l1) - sum(l2))


for s in [*open(0)][1:]:
	print(2 ** (int(s) // 2 + 1) - 2)


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	for i in range(1, n + 1):
		a.append(pow(2, i))
	n1 = int(n / 2 - 1)
	a1 = a[:n1]
	a1.append(a[-1])
	a2 = a[n1:n - 1]
	print(abs(sum(a1) - sum(a2)))


t = int(input())
for tt in range(t):
	n = int(input())
	a = []
	for i in range(1, n + 1, 1):
		a.append(2 ** i)
	b = []
	i = 1
	while len(b) < len(a):
		if i == 1:
			b.append(a[len(a) - 1])
			a.remove(a[len(a) - 1])
		else:
			b.append(a[0])
			a.remove(a[0])
		i = i + 1
	print(abs(sum(a) - sum(b)))


for i in range(int(input())):
	a = int(input())
	l = []
	for j in range(1, a + 1):
		l.append(2 ** j)
	b = 0
	for j in range(a // 2 - 1):
		b += l[j]
	b += l[len(l) - 1]
	s = 0
	for j in range(a // 2 - 1, a - 1):
		s += l[j]
	ans = abs(b - s)
	print(ans)


t = int(input(''))
while t > 0:
	n = int(input(''))
	res = []
	for i in range(1, n + 1):
		res.append(2 ** i)
	s1 = max(res)
	for i in range(n // 2 - 1):
		s1 += res[i]
	s2 = 0
	for i in range(n // 2 - 1, len(res) - 1):
		s2 += res[i]
	print(s1 - s2)
	t -= 1


for i in range(int(input())):
	n = int(input())
	k = n // 2 + 1
	if n == 2:
		print(2)
	else:
		print(2 ** k - 2)


for i in range(int(input())):
	k = int(input())
	a = k // 2
	i = 0
	c = 1
	(b, d) = ([], [])
	while i != k - 1:
		if i < a - 1:
			c *= 2
			b.append(c)
		else:
			c *= 2
			d.append(c)
		i += 1
	b.append(c * 2)
	print(abs(sum(b) - sum(d)))


t = int(input())
ta = []
for i in range(t):
	x = int(input())
	ta.append(x)
for i in range(len(ta)):
	x = ta[i]
	i = 1
	j = x
	(a, b) = (0, 0)
	x1 = x // 2
	while i < x1:
		a += 2 ** i
		i += 1
	while i < x:
		b += 2 ** i
		i += 1
	a += 2 ** j
	print(abs(a - b))


li = []
val = 1
for i in range(0, 32):
	val = val * 2
	li.append(val)
t = int(input())
for hh in range(0, t):
	n = int(input())
	ans = 0
	if n == 2:
		print(2)
	else:
		ans = li[n - 1]
		for i in range(0, n - 1):
			if i < n // 2 - 1:
				ans += li[i]
			else:
				ans -= li[i]
		print(abs(ans))


test = int(input())
while test:
	a = int(input())
	lset = sum((2 ** i for i in range(1, a // 2))) + 2 ** a
	rset = sum((2 ** i for i in range(a // 2, a)))
	print(abs(lset - rset))
	test -= 1


import math

def main():
	for q in range(int(input())):
		N = int(input())
		a = 0
		for i in range(1, N // 2):
			a += 2 ** i
		a += 2 ** N
		b = 0
		for i in range(N // 2, N):
			b += 2 ** i
		print(a - b)
main()


n = int(input())
for i in range(n):
	a = []
	b = []
	m = int(input())
	for j in range(1, m // 2):
		a.append(2 ** j)
	sum1 = sum(a)
	for k in range(m // 2, m + 1):
		b.append(2 ** k)
	sum2 = sum(b)
	print(sum1 + max(b) - (sum2 - max(b)))


for i in range(int(input())):
	n = int(input())
	sumx = 2 ** n
	sumy = 0
	for i in range(1, n // 2):
		sumx += 2 ** i
	for i in range(n // 2, n):
		sumy += 2 ** i
	print(sumx - sumy)


cases = int(input())
for j in range(cases):
	case = int(input())
	print(2 ** (case // 2 + 1) - 2)


for _ in range(int(input())):
	n = int(input())
	solution = 2 ** n
	for i in range(1, n // 2):
		solution += 2 ** i
	for i in range(n // 2, n):
		solution -= 2 ** i
	print(solution)


for _ in range(int(input())):
	n = int(input())
	a = 2 ** n
	cnt = 1
	S = sum((2 ** i for i in range(1, n + 1)))
	for i in range(1, n + 1):
		if cnt == n // 2:
			break
		else:
			a += 2 ** i
			cnt += 1
	print(2 * a - S)


import collections
import bisect
for _ in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	for i in range(1, n // 2):
		a += 2 ** i
	a += 2 ** n
	for i in range(n // 2, n):
		b += 2 ** i
	print(abs(a - b))


predp = [2 ** (i + 1) for i in range(31)]
for t in range(int(input())):
	mx = int(input())
	ans = 0
	for i in range(mx // 2 - 1):
		ans += predp[i]
	for i in range(mx // 2 - 1, mx - 1):
		ans -= predp[i]
	ans += predp[mx - 1]
	print(ans)


t = int(input())
for m in range(t):
	n = int(input())
	c = n // 2
	f = pow(2, n)
	k = 1
	for i in range(c - 1):
		p = pow(2, k)
		f += p
		k += 1
	l = 0
	j = k
	for i in range(c):
		p1 = pow(2, j)
		l += p1
		j += 1
	print(f - l)


def getCoinBalance(n: int) -> int:
	return sum([2 ** x for x in range(1, n // 2 + 1)])
for tc in range(0, int(input())):
	print(getCoinBalance(int(input())))


t = int(input())
for _ in range(t):
	n = int(input())
	coinsPerPile = n // 2
	a = 2 ** (n - coinsPerPile) - 2
	b = 2 ** n - 2 - a
	a += 2 ** n
	print(abs(a - b))


t = int(input())
for adsf in range(t):
	n = int(input())
	l = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	a = []
	for i in range(n // 2 - 1):
		a.append(l.pop(0))
	a.append(l.pop())
	ans = abs(sum(a) - sum(l))
	print(ans)


import pdb
for _ in range(int(input())):
	n = int(input())
	print(int(pow(2, n / 2 + 1) - 2))


cases = int(input())
for i in range(cases):
	n = int(input())
	print(int(2 ** (n / 2 + 1) - 2))


_ = int(input())
while _:
	n = int(input())
	sum = 0
	s1 = 0
	s2 = 0
	if n == 2:
		print(2)
		_ -= 1
		continue
	c1 = 0
	c2 = 0
	for i in range(n, 0, -1):
		if s1 <= s2:
			if c1 < n // 2:
				s1 += 2 ** i
				c1 += 1
			else:
				s2 += 2 ** i
				c2 += 1
		elif c2 < n // 2:
			s2 += 2 ** i
			c2 += 1
		else:
			s1 += 2 ** i
			c1 += 1
	sum = abs(s1 - s2)
	print(sum)
	_ -= 1


import os
import sys
from io import BytesIO, IOBase

def solution(n):
	power = [2 ** i for i in range(1, n + 1)]
	p1 = power[:n // 2 - 1] + [power[-1]]
	p2 = power[-(n // 2 + 1):][:-1]
	write(abs(sum(p1) - sum(p2)))

def main():
	for _ in range(r_int()):
		n = r_int()
		solution(n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


from math import *
from random import *
pw2 = [int(pow(2, i)) for i in range(31)]
for t in range(int(input())):
	n = int(input())
	otv = 0
	for i in range(n // 2):
		otv += pw2[i + 1]
	print(otv)


import math

def mult_input():
	return map(int, input().split())

def list_input():
	return list(map(int, input().split()))
for nt in range(int(input())):
	n = int(input())
	a = 0
	for i in range(n // 2 - 1):
		a += 2 ** (i + 1)
	a += 2 ** n
	b = 2 ** (n + 1) - 2 - a
	print(abs(b - a))


for _ in range(int(input())):
	k = int(input())
	temp = k // 2
	res = 0
	for i in range(1, temp + 1):
		res += pow(2, i)
	print(res)


from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li1():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1

def readTree(n):
	adj = [set() for _ in range(n)]
	for _ in range(n - 1):
		(u, v) = map(int, input().split())
		adj[u - 1].add(v - 1)
		adj[v - 1].add(u - 1)
	return adj

def treeOrderByDepth(n, adj, root=0):
	parent = [-2] + [-1] * (n - 1)
	ordered = []
	q = deque()
	q.append(root)
	depth = [0] * n
	while q:
		c = q.popleft()
		ordered.append(c)
		for a in adj[c]:
			if parent[a] == -1:
				parent[a] = c
				depth[a] = depth[c] + 1
				q.append(a)
	return (ordered, parent, depth)
for _ in range(ii()):
	n = ii()
	l = []
	for i in range(1, n + 1):
		l.append(int(pow(2, i)))
	a = 0
	b = 0
	x = n // 2
	for i in range(x - 1):
		a += l[i]
	a += l[-1]
	b = sum(l[x - 1:-1])
	print(a - b)


import math
t = int(input())
for g in range(0, t):
	n = int(input())
	sum1 = 0
	for j in range(0, int(n / 2) - 1):
		sum1 += pow(2, j + 1)
	sum1 += pow(2, n)
	print(abs(pow(2, n + 1) - 2 - 2 * sum1))


test_cases = int(input())
while test_cases > 0:
	num = int(input())
	numList = [2 ** i for i in range(1, num + 1)]
	total = 0
	for j in range(0, len(numList)):
		total += numList[j]
	second = 0
	for k in range(num // 2 - 1, num - 1):
		second += numList[k]
	first = total - second
	print(first - second)
	test_cases -= 1


t = int(input())
for tt in range(t):
	n = int(input())
	l = list()
	for i in range(1, n + 1):
		l.append(2 ** i)
	s = sum(l)
	k1 = 0
	for i in range(int(n / 2) - 1):
		k1 += l[i]
	k1 += l[-1]
	k2 = s - k1
	if k1 > k2:
		print(k1 - k2)
	else:
		print(k2 - k1)


n = int(input())
while n > 0:
	a = int(input())
	b = [0] * a
	sum1 = 0
	sum2 = 0
	j = 1
	for i in range(a):
		b[i] = 2 ** (i + 1)
	sum1 = b[len(b) - 1] + sum(b[0:int(len(b) / 2 - 1)])
	sum2 = sum(b) - sum1
	print(abs(sum1 - sum2))
	n -= 1


t = int(input())
for i in range(t):
	n = int(input())
	x1 = 2 ** n + 2 * (2 ** (n // 2 - 1) - 1)
	x2 = 2 * (2 ** n - 1) - 2 * x1
	print(abs(x2))


l = []
a = 1
for i in range(1, 31):
	a *= 2
	l.append(a)
for _ in range(int(input())):
	n = int(input())
	a = l[n - 1] + sum(l[:n // 2 - 1])
	b = sum(l[n // 2 - 1:n - 1])
	print(abs(a - b))


for _ in range(int(input())):
	n = int(input())
	a = 2
	p = 2
	while n > a:
		p = p * 2 + 2
		a += 2
	print(p)


for _ in range(int(input())):
	n = int(input())
	s1 = 0
	s2 = 0
	half = n // 2
	arr = [0] * n
	for i in range(n):
		arr[i] = 2 ** (i + 1)
	l = len(arr)
	s1 = arr[l - 1]
	for j in range(half):
		s2 += arr[l - 2 - j]
	for k in range(half - 1):
		s1 += arr[k]
	print(abs(s2 - s1))


import sys
input = sys.stdin.readline
import heapq
import copy
import math

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def bin_search(arr, l, r, val):
	if arr[r] <= val:
		return r + 1
	if r - l < 2:
		if arr[l] > val:
			return l
		else:
			return r
	mid = int((l + r) / 2)
	if arr[mid] <= val:
		return bin_search(arr, mid, r, val)
	else:
		return bin_search(arr, l, mid, val)

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	for test in range(tests):
		n = inp()
		total = 2 ** (n + 1) - 2
		g = 2 ** n + 2 ** int(n / 2) - 2
		print(abs(g - (total - g)))
	return 0
main()


t = int(input(''))
for i in range(t):
	n = int(input(''))
	if n == 2:
		print(2)
	else:
		a = 2 * (pow(2, n / 2 - 1) - 1) + pow(2, n)
		b = pow(2, n / 2) * (pow(2, n / 2) - 1)
		print(int(abs(a - b)))


total = int(input())
result = []
for i in range(total):
	n = int(input())
	numbers = []
	sum1 = 0
	sum2 = 0
	if n == 2:
		result.append(2)
		continue
	numbers.append(2)
	for t in range(2, n + 1):
		numbers.append(numbers[-1] * 2)
	sum1 = sum(numbers[:n // 2 - 1]) + numbers[-1]
	sum2 = sum(numbers[n // 2 - 1:n - 1])
	result.append(abs(sum1 - sum2))
for e in result:
	print(e)


t = int(input())
for x in range(t):
	n = int(input())
	print(2 + 2 * (2 ** (n // 2) - 2))


n = int(input())

def calc(x):
	arr = []
	for i in range(1, x + 1):
		arr.append(pow(2, i))
	c = arr.pop(-1)
	for i in range(x // 2 - 1):
		c = c + arr.pop(0)
	res = c - sum(arr)
	print(res)
for i in range(n):
	x = int(input())
	calc(x)


t = int(input())
while t:
	n = int(input())
	s_l = 1 << n
	s_h = 0
	for i in range(1, n // 2):
		s_l += 1 << i
	for i in range(n // 2, n):
		s_h += 1 << i
	print(s_l - s_h)
	t -= 1


T = int(input())
for i in range(T):
	a = int(input())
	z = {2: 2, 4: 6, 6: 14, 8: 30, 10: 62, 12: 126, 14: 254, 16: 510, 18: 1022, 20: 2046, 22: 4094, 24: 8190, 26: 16382, 28: 32766, 30: 65534}
	print(z[a])


for i in range(int(input())):
	n = int(input())
	s = 0
	for j in range(1, n // 2):
		s += 2 ** j
	s += 2 ** n
	s1 = 0
	for k in range(n // 2, n):
		s1 += 2 ** k
	print(s - s1)


def solve(l):
	n = int(input())
	if n == 2:
		print(2)
	else:
		(sum1, sum2) = (l[n], 0)
		for i in range(1, n // 2):
			sum1 += l[i]
		i = n // 2
		while i < n:
			sum2 += l[i]
			i += 1
		print(abs(sum1 - sum2))
try:
	l = []
	for i in range(0, 31):
		l.append(2 ** i)
	for _ in range(int(input())):
		solve(l)
except:
	pass


t = eval(input())
for j in range(t):
	n = eval(input())
	if n == 2:
		print(2)
	else:
		sum = 2
		for i in range(1, n // 2):
			sum = sum + 2 ** (i + 1)
		print(sum)


j = 2
p = 2
q = {}
while j <= 30:
	q[j] = p
	p = p * 2 + 2
	j = j + 2
for i in range(0, int(input())):
	n = int(input())
	print(q[n])


for _ in range(int(input())):
	nums = [2 ** i for i in range(1, int(input()) + 1)]
	snums = []
	snums.append(nums.pop(nums.index(max(nums))))
	for __ in range(len(nums) // 2):
		snums.append(nums.pop(nums.index(min(nums))))
	print(abs(sum(nums) - sum(snums)))


n = int(input())
for test in range(n):
	m = int(input())
	ans2 = 0
	ans1 = pow(2, m)
	for i in range(1, m // 2):
		ans1 += pow(2, i)
	for i in range(m // 2, m):
		ans2 += pow(2, i)
	print(abs(ans1 - ans2))


t = int(input())
it = 0
ar = []
for it in range(t):
	ar.append(int(input()))
for x in ar:
	if x == 2:
		print(2)
	else:
		a = 2 ** x
		for p in range(x // 2 - 1):
			a += 2 ** (p + 1)
		b = 0
		for p in range(x // 2, x):
			b += 2 ** p
		print(abs(a - b))


for _ in range(int(input())):
	n = int(input())
	b = []
	for i in range(1, n + 1):
		c = 2 ** i
		b.append(c)
	d = int(n / 2 - 1)
	l = sum(b[0:d]) + b[-1]
	p = sum(b[d:-1])
	print(abs(l - p))


t = int(input())
cnt = 0
for cnt in range(t):
	n = int(input())
	a = list()
	b = list()
	c = list()
	for i in range(n):
		a.append(2 ** (i + 1))
	sum = 0
	sum += a[n - 1]
	for i in range(len(a) // 2 - 1):
		sum += a[i]
	for i in range(len(a) // 2 - 1, len(a) - 1):
		sum -= a[i]
	if sum < 0:
		sum = sum * -1
	print(sum)
	a.clear()


for i in range(int(input())):
	n = int(input())
	l = [2 ** (i + 1) for i in range(n)]
	p1 = l[-1] + sum(l[:n // 2 - 1])
	p2 = sum(l[n // 2 - 1:-1])
	print(abs(p1 - p2))


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())
for _ in range(int(input())):
	n = int(input())
	arr = []
	for i in range(1, n + 1):
		arr.append(2 ** i)
	i = n - 2
	sum1 = 0
	count = 0
	while count != n // 2:
		sum1 += arr[i]
		i -= 1
		count += 1
	sum2 = 0
	for j in range(i + 1):
		sum2 += arr[j]
	sum2 += arr[-1]
	print(abs(sum1 - sum2))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	even = 0
	odd = 0
	for i in range(1, n + 1):
		if i <= n // 2 - 1 or i == n:
			even += 2 ** i
		else:
			odd += 2 ** i
	print(even - odd)


t = int(input())
for _ in range(t):
	ab = 0
	n = int(input())
	for i in range(1, n + 1):
		if i < int(n / 2) or i == n:
			ab += pow(2, i)
		else:
			ab -= pow(2, i)
	print(ab)


cases = int(input())
for i in range(cases):
	n = int(input())
	m = n // 2 - 1
	ans = 2 ** n
	for k in range(1, m + 1):
		ans += 2 ** k
	for k in range(m + 1, n):
		ans -= 2 ** k
	print(ans)


T = int(input())
for _ in range(0, T):
	n = int(input())
	tot = 2 ** n
	ans = 0
	for i in range(1, n // 2):
		tot += 1 << i
	for i in range(1, n + 1):
		ans += 1 << i
	ans = ans - tot
	print(abs(ans - tot))


n = int(input())
for i in range(n):
	s = int(input())
	li = []
	for i in range(1, s + 1):
		t = 2 ** i
		li.append(t)
	m = s // 2 - 1
	(c, d) = (0, 0)
	for j in range(s - 1):
		if j < m:
			c = c + li[j]
		else:
			d = d + li[j]
	c = c + li[-1]
	print(c - d)


def solve():
	n = int(input())
	if n == 2:
		print(2)
		return
	if n == 4:
		print(6)
		return
	x = 2
	summ = 0
	while x <= 2 ** (n // 2 - 1):
		summ += x
		x *= 2
	summ += 2 ** n
	x = 2 ** (n // 2)
	other = 0
	while x < 2 ** n:
		other += x
		x *= 2
	print(abs(other - summ))
t = int(input())
for i in range(t):
	solve()


def Diff(X, G):
	return list(set(X) - set(G))
for t in range(int(input())):
	l = int(input())
	X = []
	G = []
	q = []
	su = 1
	for i in range(l):
		X.append(2 ** (i + 1))
	g = len(X) / 2
	G.append(X[l - 1])
	k = g - 1
	for o in range(l):
		if k >= su:
			G.append(X[o])
			su = su + 1
	q = Diff(X, G)
	print(int(sum(G) - sum(q)))


t = int(input())
for i in range(t):
	n = int(input())
	left = 2 ** n + -(2 * (1 - 2 ** (n // 2 - 1)))
	right = -2 ** (n // 2) * (1 - 2 ** (n // 2))
	print(abs(left - right))


import sys
from collections import defaultdict, deque
import math
import heapq
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	a = 0
	for i in range(1, n // 2):
		a += 1 << i
	a += 1 << n
	b = 0
	for i in range(n // 2, n):
		b += 1 << i
	print(abs(a - b))


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	for i in range(1, n + 1):
		a.append(2 ** i)
	x = n // 2
	suma = a[n - 1] + sum(a[0:x - 1])
	sumb = sum(a[x - 1:n - 1])
	print(suma - sumb)


import sys
input = sys.stdin.readline

def inp():
	return int(input())
rep = []
cnt = inp()
for i in range(cnt):
	exp = inp()
	n1 = 0
	n2 = 2 ** exp
	for j in range(1, exp // 2):
		n2 = n2 + 2 ** j
	for j in range(exp // 2, exp):
		n1 = n1 + 2 ** j
	rep.append(n2 - n1)
for i in rep:
	print(i)


t = int(input())
for eqw in range(t):
	n = int(input())
	a = []
	b = []
	for i in range(1, n // 2):
		a.append(2 ** i)
	for i in range(n // 2, n):
		b.append(2 ** i)
	a.append(2 ** n)
	print(abs(sum(a) - sum(b)))


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	if n == 2:
		ans.append(2)
	else:
		ans.append(2 * (2 ** n + 2 ** (n // 2) - 2) - (2 ** (n + 1) - 2))
for i in ans:
	print(i)


for _ in range(int(input())):
	n = int(input())
	(a, total) = (0, 0)
	b = pow(2, n)
	for i in range(1, n // 2):
		b += pow(2, i)
	for i in range(1, n + 1):
		total += pow(2, i)
	a = total - b
	print(b - a)


t = int(input())
while t > 0:
	t -= 1
	a = int(input())
	res = 0
	for i in range(1, int(a / 2)):
		res += 2 ** i
	print(res * 2 + 2)


t = int(input())
while t > 0:
	n = int(input())
	mid = n // 2
	L = [2 ** i for i in range(1, mid)]
	A = [2 ** i for i in range(mid, n)]
	print(2 ** n + sum(L) - sum(A))
	t -= 1


inp = input
li = list
iinp = lambda : int(inp())
ent = lambda : map(int, inp().split())
lient = lambda : [int(i) for i in inp().split()]
li0 = lambda x: [0 for i in range(x)]
livalor = lambda valor, x: [valor for i in range(x)]
stent = lambda : [i for i in inp()]
filldp = lambda valor, x, y: [[valor for i in range(y)] for i in range(x)]
ab = abs
t = iinp()
for _ in range(t):
	n = iinp()
	if n == 2:
		print(2)
		continue
	a = 0
	b = 2 ** n
	for i in range(n - n // 2, n):
		a = a + 2 ** i
	for i in range(1, n // 2):
		b = b + 2 ** i
	print(ab(a - b))


import sys
import math
input = sys.stdin.buffer.readline

def main():
	n = int(input())
	a = sum([2 ** i for i in range(1, n // 2)])
	a += 2 ** n
	b = sum([2 ** i for i in range(n // 2, n)])
	d = abs(a - b)
	return d
t = int(input())
while t:
	t -= 1
	print(main())


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
for _ in range(int(input())):
	n = int(input())
	x = 2
	(a, b) = (0, 0)
	for i in range(n // 2 - 1):
		a += x
		x = x * 2
	for i in range(n // 2):
		b += x
		x = x * 2
	a += x
	print(abs(a - b))


for _ in range(int(input())):
	n = int(input())
	sm = 2 ** (n + 1) - 2
	bh = 2 ** n + 2 ** (n // 2) - 2
	print(2 * bh - sm)


t = int(input())
for x in range(t):
	n = int(input())
	somme = 0
	for y in range(int(n / 2)):
		somme += 2 ** (y + 1)
	print(somme)


t = int(input())
lst = []
for i in range(t):
	n = int(input())
	lst.append(n)
for j in lst:
	if j == 2:
		print(2)
	else:
		coins = [2 ** i for i in range(1, j + 1)]
		middle = j // 2 - 1
		a = sum(coins[:middle]) + coins[j - 1]
		b = sum(coins[middle:j - 1])
		print(abs(a - b))


l = [2 ** (i + 1) for i in range(32)]
l = sorted(l)
for _ in range(int(input())):
	n = int(input())
	req = n // 2
	n -= 1
	req -= 1
	sm = l[n]
	j = 0
	while req > 0:
		sm += l[j]
		j += 1
		req -= 1
	while j < n:
		sm -= l[j]
		j += 1
	print(abs(sm))


t = int(input())
for p in range(0, t):
	n = int(input())
	sum = 2 ** (n / 2) * (2 ** (n / 2) - 1)
	sum2 = 2 * (2 ** (n / 2 - 1) - 1) + 2 ** n
	print(int(sum2 - sum))


def shovel(n):
	sum = 0
	for i in range(n // 2, 0, -1):
		sum += 2 ** i
	return sum
for t in range(int(input())):
	n = int(input())
	print(shovel(n))


size = int(input())
list1 = []
list2 = []
for i in range(size):
	y = 1
	sum1 = 0
	sum2 = 0
	value = int(input())
	for i in range(value):
		if i < int(value / 2):
			list1.append(2 ** y)
			y += 1
		else:
			list2.append(2 ** y)
			y += 1
	for i in range(len(list1) - 1):
		sum1 += list1[i]
		sum2 += list2[i]
	sum1 = sum1 + list2[-1]
	sum2 = sum2 + list1[-1]
	list1.clear()
	list2.clear()
	print(abs(sum1 - sum2))


for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(2)
	else:
		res = 2 ** n
		dif = 0
		for i in range(1, n):
			if i <= (n - 1) // 2:
				res += 2 ** i
			else:
				dif += 2 ** i
		print(abs(res - dif))


t = int(input())
cases = []
while t > 0:
	cases.append(int(input()))
	t -= 1
for case in cases:
	result = 0
	b = 0
	for n in range(1, case // 2):
		result += 2 ** n
	for n in range(1, case):
		b += 2 ** n
	print(2 ** case + 2 * result - b)


n = int(input())
for i in range(n):
	x = int(input())
	returnval = 2 ** (x // 2 + 1) - 2
	print(int(returnval))


t = int(input())
count = 0
coin = []
while count < t:
	n_coins = int(input())
	coin.append(n_coins)
	count += 1
for x in coin:
	pile = x // 2
	w = [2 ** y for y in range(1, x + 1)]
	f_pile = [w[-1]]
	s_pile = []
	w.pop(-1)
	for y in w:
		if len(f_pile) != pile:
			f_pile.append(y)
		else:
			s_pile.append(y)
	print(abs(sum(f_pile) - sum(s_pile)))


T = int(input())
for case in range(T):
	n = int(input())
	diff = 2
	delta = 0
	for i in range(1, n // 2):
		delta += 2 ** i
	diff += 2 * delta
	print(diff)


import math
for _ in range(int(input())):
	n = int(input())
	m = n // 2
	z = m - 1
	(a, b, c) = (0, 0, 0)
	li = [int(math.pow(2, i)) for i in range(1, n + 1)]
	for i in range(z):
		a = a + li[i]
	a += li[-1]
	for i in range(z, n - 1):
		b += li[i]
	print(a - b)


T = int(input())
for _ in range(T):
	N = int(input())
	cs = [2 ** i for i in range(1, N + 1)]
	a = sum(cs[N // 2 - 1:-1])
	b = sum(cs) - a
	print(abs(a - b))


for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(2)
		continue
	a = 2 ** n
	for i in range(1, n):
		if i < n // 2:
			a += 2 ** i
		else:
			a -= 2 ** i
	print(abs(a))


import math
t = int(input())
for z in range(t):
	n = int(input())
	count1 = 2
	sum2 = 0
	sum1 = int(math.pow(2, n))
	i = 1
	count2 = int(math.pow(2, n))
	while i <= n // 2:
		count2 = count2 // 2
		sum2 += count2
		i += 1
	i = 1
	while i < n // 2:
		sum1 += count1
		count1 = count1 * 2
		i += 1
	print(abs(sum2 - sum1))


from math import ceil
for __ in range(int(input())):
	n = int(input())
	(a, b) = (0, 0)
	(y, x) = (n - 1, n - n // 2)
	for i in range(1, n + 1):
		if i >= x and i <= y:
			a += 2 ** i
		else:
			b += 2 ** i
	print(abs(a - b))


import math
for _ in range(int(input())):
	n = int(input())
	sum1 = []
	sum2 = []
	a = n // 2
	sum1.append(math.pow(2, n))
	for i in range(n - 1, n // 2 - 1, -1):
		sum2.append(math.pow(2, i))
	for j in range(1, n // 2):
		sum1.append(math.pow(2, j))
	print(int(abs(sum(sum2) - sum(sum1))))


def solve_task(n):
	res = 0
	return abs(sum([2 ** (i + 1) for i in range(n // 2 - 1, n - 1)]) - (sum([2 ** (i + 1) for i in range(n // 2 - 1)]) + 2 ** n))

def main():
	n_coins = int(input())
	tasks = []
	for n_task in range(n_coins):
		tasks.append(int(input()))
	solutions = []
	for t in tasks:
		solutions.append(solve_task(t))
	for s in solutions:
		print(s)
main()


def f(n):
	if n == 0:
		return 0
	else:
		return abs(2 ** (n // 2 + 1) - 2)
lst = []
for i in range(int(input())):
	lst.append(f(int(input())))
for i in lst:
	print(i)


for _ in range(int(input())):
	n = int(input())
	weights = [2 ** i if i <= n // 2 - 1 else -2 ** i for i in range(1, n)]
	print(sum(weights) + 2 ** n)


numberOfTest = int(input())
for _ in range(numberOfTest):
	n = int(input())
	totalSum = 2 ** (n + 1) - 2
	leftSum = 2 ** n
	if n > 4:
		for i in range(0, int(n / 2) - 1):
			leftSum += 2 ** (i + 1)
	elif n == 4:
		leftSum += 2
	print(abs(totalSum - 2 * leftSum))


n = int(input())
for i in range(n):
	count1 = 0
	count2 = 0
	b = []
	a = int(input())
	for j in range(1, a + 1):
		b.append(2 ** j)
	count1 = b[a - 1]
	for k in range(len(b) - 1):
		if k <= (a - 1) // 2 - 1:
			count1 += b[k]
		else:
			count2 += b[k]
	print(abs(count1 - count2))


def solve(n):
	return 2 ** (n // 2 + 1) - 2
m = int(input())
for _ in range(m):
	n = int(input())
	print(solve(n))


import sys
lines = []
for line in sys.stdin:
	lines.append(line.rstrip('\n'))
for nb_coins in lines[1:]:
	p = 2
	r = 2
	while p < int(nb_coins):
		p += 2
		r = r * 2 + 2
	print(r)


t = int(input())
for i in range(t):
	n = int(input())
	f = 0
	lst1 = []
	lst2 = []
	if n == 2:
		f = 1
		p = 2
	else:
		for j in range(1, n + 1):
			if j < n / 2 or j == n:
				lst1.append(2 ** j)
			else:
				lst2.append(2 ** j)
	if f == 0:
		p = sum(lst1) - sum(lst2)
	print(p)


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	for i in range(n):
		a.append(2 ** (i + 1))
	print(sum(a[:n // 2 - 1]) + a[-1] - sum(a[n // 2 - 1:n - 1]))


q = int(input())
for i in range(0, q):
	n = int(input())
	k = n // 2
	sum = 0
	l = 1
	while k != l - 1:
		sum += 2 ** l
		l += 1
	print(sum)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = 0
	b = 0
	for i in range(1, n // 2):
		a += pow(2, i)
	for i in range(n // 2, n):
		b += pow(2, i)
	a += pow(2, n)
	if a > b:
		print(a - b)
	else:
		print(b - a)


import math
from sys import stdin, stdout
T = int(stdin.readline())
for i in range(T):
	N = int(stdin.readline())
	if N == 2:
		print('2')
		continue
	rsm = 0
	lsm = 0
	lsm = pow(2, N // 2) - 2 + pow(2, N)
	rsm = pow(2, N) - 1 - (pow(2, N // 2) - 1)
	print(abs(lsm - rsm))


t = int(input())
for i in range(t):
	n = int(input())
	n = n // 2
	a1 = 2
	d = 4
	for j in range(n - 1):
		a1 = a1 + d
		d = d * 2
	print(a1)


t = int(input())
for _ in range(t):
	counter = a = b = 0
	coins = []
	n = int(input())
	if n == 2:
		print(2)
		continue
	for i in range(1, n + 1):
		coins.append(2 ** i)
	a += coins[-1]
	a += sum(coins[:n // 2 - 1])
	b += sum((x for x in coins[n // 2 - 1:-1]))
	print(abs(a - b))


queries = int(input())
for _ in range(queries):
	numbers = int(input())
	array = list(range(numbers))
	numbers //= 2
	first = array[:numbers - 1]
	first.append(array[-1])
	second = array[numbers - 1:len(array) - 1]
	firstPile = 0
	secondPile = 0
	for (x, y) in zip(first, second):
		firstPile += 2 ** (x + 1)
		secondPile += 2 ** (y + 1)
	print(abs(firstPile - secondPile))


t = int(input())
for i in range(t):
	n = int(input())
	dp = []
	for i in range(31):
		dp.append(0)
	dp[2] = 2
	sum = 2
	for j in range(4, n + 1, 2):
		dp[j] = j + sum
		sum += dp[j]
	print(dp[n])


t = int(input())
for i1 in range(t):
	n = int(input())
	print(int(2 ** (n / 2 + 1) - 2))


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(n):
		l.append(2 ** (i + 1))
	s1 = 0
	s2 = l[-1]
	for i in range(n // 2 - 1, n - 1):
		s1 += l[i]
	for i in range(0, n // 2 - 1):
		s2 += l[i]
	print(abs(s2 - s1))


for _ in range(int(input())):
	n = int(input())
	l = [2 ** i for i in range(1, n + 1)]
	if n == 2:
		print(2)
	else:
		e = int(n / 2) - 1
		print(l[-1] + sum(l[:e]) - sum(l[e:n - 1]))


t = int(input())
for a in range(t):
	n = int(input())
	result = 2 ** (n / 2 + 1) - 2
	print(int(result))


def solve():
	n = int(input())
	sumn = 2 ** (n + 1)
	j = n / 2
	sumj = 2 ** j + 2 ** n - 1
	print(int(2 * sumj - sumn))
t = int(input())
i = 0
while i < t:
	i += 1
	solve()


t = int(input())
x = []
for i in range(1, 31):
	x.append(2 ** i)
for i in range(t):
	n = int(input())
	y = n // 2 - 1
	a = sum(x[y:n - 1])
	b = sum(x[:y]) + x[n - 1]
	print(abs(a - b))


t = int(input())
for i in range(t):
	n = int(input())
	tem = []
	for i in range(1, n + 1):
		tem.append(2 ** i)
	s1 = sum(tem[:n // 2 - 1]) + tem[n - 1]
	s2 = sum(tem[n // 2 - 1:n - 1])
	print(abs(s1 - s2))


t = int(input())
while t > 0:
	n = int(input())
	num = {2: 2, 4: 6}
	for i in range(6, n + 1, 2):
		half = i // 2
		num[i] = num[i - 2] + 2 ** half
	print(num[n])
	t = t - 1


kl = int(input())
for l in range(kl):
	n = int(input())
	print(2 ** (n // 2 + 1) - 2)


t = int(input())
for test in range(t):
	n = int(input())
	a = 2 ** n
	sb = 0
	sa = a
	for i in range(n // 2):
		a = a // 2
		sb += a
	for i in range(n // 2 - 1):
		a = a // 2
		sa += a
	print(abs(sb - sa))


def solve():
	ans = 2 ** n
	for i in range(n // 2):
		ans -= 2 ** (n - 1 - i)
	for i in range(n // 2 - 1):
		ans += 2 ** (i + 1)
	return ans
t = int(input())
for i in range(1, t + 1):
	n = int(input())
	print(solve())


t = int(input())
while t > 0:
	n = int(input())
	a = [2 ** i for i in range(1, n + 1)]
	(a1, a2) = ([], [])
	for i in range(0, len(a)):
		if i + 1 < len(a) // 2:
			a1.append(2 ** (i + 1))
		elif 2 ** (i + 1) == 2 ** n:
			a1.append(2 ** n)
			break
		else:
			a2.append(2 ** (i + 1))
	print(sum(a1) - sum(a2))
	t -= 1


for _ in range(int(input())):
	n = int(input())
	k = []
	for i in range(n):
		k.append(2 ** (i + 1))
	z = sum(k[:n // 2 - 1]) + k[-1]
	z1 = sum(k[n // 2 - 1:-1])
	print(abs(z - z1))


t = int(input())
for i in range(t):
	array = list()
	n = int(input())
	for j in range(n):
		x = 2 ** (j + 1)
		array.append(x)
	array.reverse()
	array1 = list()
	array2 = list()
	for element in array:
		if sum(array1) <= sum(array2):
			if len(array1) != n / 2:
				array1.append(element)
			else:
				array2.append(element)
		elif len(array2) != n / 2:
			array2.append(element)
		else:
			array1.append(element)
	print(abs(sum(array1) - sum(array2)))


n_cases = int(input())
for case_num in range(n_cases):
	n = int(input())
	c1 = 2 ** n + sum([2 ** k for k in range(1, n // 2)])
	c2 = sum([2 ** k for k in range(n // 2, n)])
	print(abs(c1 - c2))


for _ in range(int(input())):
	p = int(input())
	List = []
	for x in range(1, p + 1):
		List.append(2 ** x)
	a = List[0:int(len(List) / 2) - 1]
	a.append(List[-1])
	b = List[int(len(List) / 2) - 1:-1]
	print(sum(a) - sum(b))


def f(n):
	sumg = 2 ** n
	suml = 0
	for i in range(1, int(n / 2)):
		sumg += 2 ** i
	for i in range(int(n / 2), n):
		suml += 2 ** i
	return sumg - suml
n = int(input())
for i in range(n):
	k = int(input())
	print(f(k))


for _ in range(int(input())):
	n = int(input())
	hlf = n // 2
	one_p = 2 ** n
	for i in range(1, hlf):
		one_p += 2 ** i
	two_o = 0
	for i in range(hlf, n):
		two_o += 2 ** i
	print(abs(one_p - two_o))


from math import *
test = int(input())
for j in range(test):
	n = int(input())
	a = pow(2, n)
	b = 0
	for i in range(1, n):
		if i < n / 2:
			a += pow(2, i)
		else:
			b += pow(2, i)
	print(int(a - b))


n = int(input())
data = []
prev = 1
for i in range(1, 31):
	data.append(prev * 2)
	prev *= 2
for i in range(n):
	k = int(input())
	a = data[k - 1] + sum(data[:int(k / 2) - 1])
	b = sum(data[int(k / 2) - 1:k - 1])
	print(a - b)


t = int(input())
for u in range(t):
	n = int(input())
	ans = 0
	for i in range(1, n // 2):
		ans += 2 ** i
	ans += 2 ** n
	b = 0
	for i in range(n // 2, n):
		b += 2 ** i
	print(abs(ans - b))


def main():
	T = int(input().strip())
	for _ in range(T):
		n = int(input().strip())
		n_half = n // 2
		a = 2 ** n
		b = 0
		for i in range(1, n):
			if i < n_half:
				a += 2 ** i
			else:
				b += 2 ** i
		print(abs(a - b))
main()


import sys

def read():
	return list(map(int, sys.stdin.readline().rstrip().split(' ')))

def diff(n):
	k = n // 2
	return 2 * (2 ** k - 1)
(t,) = read()
for _ in range(t):
	(n,) = read()
	print(diff(n))


def main():
	for _ in range(int(input())):
		n = int(input())
		a = [pow(2, n)]
		for i in range(1, n // 2):
			a.append(pow(2, i))
		b = [pow(2, i) for i in range(n // 2, n)]
		print(sum(a) - sum(b))
main()


n = int(input())
for i in range(n):
	c = int(input())
	d = 2 ** (c / 2 + 1) - 2
	print(int(d))


testCases = int(input())
for _ in range(testCases):
	n = int(input())
	group1 = 2 ** n
	group2 = 0
	for index in range(1, n // 2):
		group1 += 2 ** index
	for index_ in range(n // 2, n):
		group2 += 2 ** index_
	print(abs(group1 - group2))


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	os = 0
	ind = n - 2
	c = 0
	while c < n // 2:
		os += l[ind]
		ind -= 1
		c += 1
	ts = sum(l) - os
	print(abs(ts - os))


t = int(input())
for y in range(t):
	n = int(input())
	res = pow(2, n)
	for i in range(n - 1, 0, -1):
		if i >= n // 2:
			res -= pow(2, i)
		else:
			res += pow(2, i)
	print(int(res))


t = int(input())
for i in range(t):
	x = int(input())
	first = [2 ** i for i in range(1, x // 2)]
	second = [2 ** i for i in range(x // 2, x)]
	print(sum(first) + 2 ** x - sum(second))


li = [-1]
for i in range(1, 31):
	li.append(2 ** i)
t = int(input())
for _ in range(t):
	n = int(input())
	a1 = 0
	a2 = 0
	val = n // 2
	a1 = sum(li[val:n])
	a2 = sum(li[1:val]) + li[n]
	print(abs(a1 - a2))


t = int(input())
for _ in range(t):
	n = int(input())
	m = 0
	v = 2 ** n
	if n == 2:
		print(2)
		continue
	for i in range(1, n // 2):
		v = v + 2 ** i
	for i in range(n // 2, n):
		m = m + 2 ** i
	print(v - m)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	current = 2
	p1 = 2 ** n
	p2 = 0
	for _ in range(n // 2 - 1):
		p1 += current
		current *= 2
	for _ in range(n // 2):
		p2 += current
		current *= 2
	print(abs(p1 - p2))


def solution(a):
	s = 0
	i = 1
	j = a
	z = []
	k = []
	for i in range(1, a + 1):
		z.append(2 ** i)
	print(z[-1] + sum(z[:a // 2 - 1]) - sum(z[a // 2 - 1:a - 1]))
for i in range(int(input())):
	solution(int(input()))


import math
t = int(input())
for q in range(t):
	n = int(input())
	(s1, s2) = (0, 0)
	for i in range(1, int(n / 2)):
		s1 += 2 ** i
	s1 += 2 ** n
	for i in range(int(n / 2), n):
		s2 += 2 ** i
	print(int(math.fabs(s1 - s2)))


from collections import *
import sys
mod = 10 ** 9 + 7

def main():
	n = int(input())
	arr = [2]
	for i in range(1, n):
		arr.append(arr[-1] * 2)
	t = n // 2
	t -= 1
	a = sum(arr[:t]) + arr[-1]
	b = sum(arr[t:]) - arr[-1]
	print(abs(a - b))
for i in range(int(input())):
	main()


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	ans = []
	for _ in range(t):
		n = int(stdin.readline())
		coins = [1 << i for i in range(1, n + 1)]
		res = 0
		for i in range(n // 2):
			res += coins[i + 1] - coins[i]
		ans.append(res)
	stdout.write('\n'.join(map(str, ans)))
main()


t = int(input())
for _ in range(t):
	tab = []
	sum1 = 0
	sum2 = 0
	n = int(input())
	i = 1
	x = 1
	while i <= n:
		x *= 2
		tab.append(x)
		i += 1
	(tab[n // 2 - 1], tab[-1]) = (tab[-1], tab[n // 2 - 1])
	for p in range(n // 2):
		sum1 += tab[p]
	for o in range(n // 2, n):
		sum2 += tab[o]
	print(sum1 - sum2)


for _ in range(int(input())):
	n = int(input())
	a = pow(2, n // 2) + pow(2, n) - 2
	b = pow(2, n + 1) - 2 - a
	print(abs(a - b))


for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(2)
		continue
	l = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	print(sum(l[:n // 2]))


T = int(input())
for t in range(T):
	n = int(input())
	li = [2 ** i for i in range(1, n + 1)]
	sum1 = sum(li[int(n / 2) - 1:-1])
	sum2 = sum(li) - sum1
	print(sum2 - sum1)


c = int(input())
for n in [int(input()) for i in range(c)]:
	a = pow(2, n) + sum(map(lambda x: pow(2, x), range(1, n // 2)))
	b = sum(map(lambda x: pow(2, x), range(n // 2, n)))
	print(a - b)


T = int(input())
while T != 0:
	n = int(input())
	val = []
	for i in range(1, n + 1):
		val.append(2 ** i)
	s = 0
	for i in range(len(val) // 2 - 1):
		s += val[i]
	s += val[-1]
	print(abs(s - (sum(val) - s)))
	T -= 1


for i in range(int(input())):
	n = int(input())
	l = [2 ** i for i in range(1, n + 1)]
	if n == 2:
		print(2)
	else:
		d = sum(l[n // 2 - 1:n - 1])
		print(sum(l) - 2 * d)


from functools import reduce
for _ in range(int(input())):
	n = int(input())
	print(2 ** (n // 2 + 1) - 2)


t = int(input())
for i in range(t):
	n = int(input())
	num = n // 2
	sa = 0
	sb = 0
	if n == 2:
		print(2)
	else:
		for j in range(1, n // 2):
			sa = sa + pow(2, j)
		sa = sa + pow(2, n)
		for j in range(n // 2, n):
			sb = sb + pow(2, j)
		print(abs(sa - sb))


for t in range(int(input())):
	n = int(input())
	a = [2 ** x for x in range(n, 0, -1)]
	fl = 0
	sl = 0
	fl += a[0]
	sl += a[1]
	del a[0:2]
	for i in range(int(len(a) / 2)):
		sl += a[i]
	for i in range(int(len(a) / 2), len(a)):
		fl += a[i]
	print(abs(fl - sl))


for _ in range(int(input())):
	N = int(input())
	sum1 = 2 ** N
	sum2 = 0
	count = 1
	for i in range(1, N):
		if count < N // 2:
			sum1 += 2 ** i
			count += 1
		else:
			sum2 += 2 ** i
	print(abs(sum1 - sum2))


t = int(input())
for _ in range(0, t):
	n = int(input())
	sum1 = 0
	sum2 = 0
	a = []
	for i in range(1, n + 1):
		a.append(2 ** i)
	sum1 = a[len(a) - 1]
	sum2 = a[len(a) - 2]
	a.pop(n - 1)
	a.pop(n - 2)
	while len(a):
		if sum1 > sum2:
			sum1 += a[0]
			sum2 += a[len(a) - 1]
			a.pop(0)
			a.pop(len(a) - 1)
		else:
			sum2 += a[0]
			sum1 += a[len(a) - 1]
			a.pop(0)
			a.pop(len(a) - 1)
	print(abs(sum2 - sum1))


for t in range(int(input())):
	print(2 ** (int(input()) // 2) * 2 - 2)


import math
I = lambda : list(map(int, input().split(' ')))
for _ in range(int(input())):
	n = int(input())
	s = 0
	p = 1
	for i in range(n):
		p = 2 * p
		if i < n // 2 - 1 or i == n - 1:
			s += p
		else:
			s -= p
	print(s)


n = int(input())
l1 = []
for i in range(n):
	x = int(input())
	if x == 2:
		l1.append(2)
	elif x == 4:
		l1.append(6)
	else:
		s1 = 2 ** x
		first = x // 2 - 1
		s1 += 2 * (2 ** first - 1)
		s2 = 2 * (2 ** x - 1) - s1
		l1.append(abs(s1 - s2))
for item in l1:
	print(item)


for _ in range(int(input())):
	a = int(input())
	b = [2 ** (i + 1) for i in range(a)]
	c = max(b) + sum([b[i] for i in range(len(b) // 2 - 1)])
	d = sum([b[i] for i in range(len(b) // 2 - 1, len(b) - 1)])
	print(abs(c - d))


t = int(input())
for i in range(t):
	n = list(range(1, int(input()) + 1))
	powers = [2 ** i for i in n]
	half = len(n) // 2
	if half == 1:
		print(2)
	else:
		a = powers[-1] + sum(powers[:half - 1])
		b = sum(powers) - a
		print(abs(a - b))


a = int(input())
for i in range(a):
	d = int(input())
	print(2 ** (d // 2 + 1) - 2)


A = []
pow = 2
for i in range(29):
	if i % 2 == 0:
		A.append(2 ** pow - 2)
		pow += 1
	else:
		A.append(0)
for _ in range(int(input())):
	N = int(input())
	print(A[N - 2])


t = int(input())
for tt in range(t):
	n = int(input())
	l = []
	l2 = []
	l3 = []
	for i in range(1, n + 1):
		r = 2 ** i
		l.append(r)
	print(sum(l[:n // 2]))


a = []
for i in range(0, 40):
	a.append(pow(2, i))
for _ in range(int(input())):
	(c, b) = (0, 0)
	n = int(input())
	for i in range(1, n // 2):
		c += a[i]
	c += a[n]
	for i in range(1, n + 1):
		b += a[i]
	b = b - c
	print(abs(b - c))


t = int(input())
for _ in range(t):
	(aux1, aux2, ans) = (0, 0, 0)
	n = int(input())
	lista = [int(2 ** i) for i in range(1, n + 1)]
	aux1 = sum(lista)
	lista.sort(reverse=True)
	if n == 2:
		print(aux1 - lista[0])
	else:
		for i in range(int(n / 2)):
			aux2 += lista[i]
		print(aux1 - aux2)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]
for _ in range(int(input())):
	n = int(input())
	a = []
	for i in range(1, n + 1):
		a.append(2 ** i)
	l = 0
	h = len(a) - 1
	(b, c) = (0, 0)
	c += a[-1]
	b += a[-2]
	for i in range(0, n // 2 - 1):
		c += a[i]
	for i in range(n // 2 - 1, n - 2):
		b += a[i]
	print(abs(b - c))


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(1, n + 1):
		l.append(pow(2, i))
	a = n // 2
	firstpile = 0
	secondpile = 0
	for i in range(a - 1):
		firstpile += l[i]
	firstpile += l[-1]
	for i in range(a - 1, len(l) - 1):
		secondpile += l[i]
	print(abs(secondpile - firstpile))


t = int(input())
for i in range(t):
	n = int(input())
	mas = []
	for j in range(1, n + 1):
		mas.append(2 ** j)
	first = mas[-1]
	mas.pop()
	for m in range(0, n // 2 - 1):
		first += mas[m]
	second = 0
	for k in range(n // 2 - 1, len(mas)):
		second += mas[k]
	print(abs(first - second))


for _ in range(int(input())):
	n = int(input())
	lst = []
	for i in range(1, n // 2 + 1):
		lst.append(2 ** i)
	print(sum(lst))


t = int(input())
while t > 0:
	(pile1, pile2) = (0, 0)
	n = int(input()) + 2
	n //= 2
	print(2 ** n - 2)
	t -= 1


t = int(input())
for rep in range(0, t):
	n = int(input())
	a_sum = 2 ** n
	b_sum = 0
	for i in range(1, n // 2):
		a_sum += 2 ** i
	for j in range(n // 2, n):
		b_sum += 2 ** j
	print(abs(a_sum - b_sum))


for _ in range(int(input())):
	n = int(input())
	summ1 = 2 * (2 ** n - 1)
	m = n // 2 - 1
	summ2 = 2 ** n + 2 * (2 ** m - 1)
	print(2 * summ2 - summ1)


pow = [None] * 30
pow[0] = 2
for i in range(1, 30):
	pow[i] = pow[i - 1] * 2
t = int(input())
while t:
	t -= 1
	c = int(input())
	half = int(c / 2)
	sum1 = pow[c - 1] + sum(pow[:half - 1])
	sum2 = sum(pow[half - 1:c - 1])
	print(sum1 - sum2)


s = []
for iii in range(int(input())):
	n = int(input())
	p = [2 ** i for i in range(n // 2, n)]
	l = [2 ** i for i in range(1, n // 2)]
	l.append(2 ** n)
	s.append(sum(l) - sum(p))
for i in s:
	print(i)


def answer(n):
	count = 0
	for i in range(1, n):
		count += 2 ** i
	countf = 0
	for i in range(1, n // 2):
		countf += 2 ** i
	counts = count - countf
	countf += 2 ** n
	return abs(counts - countf)
t = int(input())
for i in range(t):
	n = int(input())
	print(answer(n))


for i in range(int(input())):
	n = int(input())
	sum1 = 0
	sum2 = 0
	for p in range(1, n):
		if p <= n / 2 - 1:
			sum1 += 2 ** p
		else:
			sum2 += 2 ** p
	sum1 += 2 ** n
	print(abs(sum2 - sum1))


data = [0, 2, 4]
for q in range(3, 31):
	data.append(data[-1] * 2)
for _ in range(int(input())):
	n = int(input())
	ans1 = data[n] + sum(data[1:n // 2])
	ans2 = sum(data[n // 2:n])
	print(abs(ans1 - ans2))


t = int(input())
for i in range(t):
	n = int(input())
	ans = 2 ** n
	index = 0
	while index != n // 2 - 1:
		ans += 2 ** (index + 1)
		index += 1
	while index != n - 1:
		ans -= 2 ** (index + 1)
		index += 1
	print(ans)


n = int(input())
while n:
	a = int(input())
	ans = 2
	if a == 2:
		print(ans)
	else:
		for i in range(0, a // 2 - 1):
			ans = ans * 2 + 2
		print(ans)
	n = n - 1


for case in range(int(input())):
	n = int(input())
	print(2 ** (n // 2 + 1) - 2)


test_cases = int(input())
for i in range(0, test_cases):
	x = int(input())
	values = []
	a = []
	b = []
	for j in range(1, x + 1):
		values.append(2 ** j)
	length = int(len(values))
	for l in range(0, length // 2 - 1):
		a.append(values[l])
	for k in range(length // 2 - 1, length):
		b.append(values[k])
	y = []
	q = b.pop()
	y.append(q)
	a = a + y
	sum1 = sum(a)
	sum2 = sum(b)
	print(abs(sum1 - sum2))


t = int(input())
for i in range(0, t):
	n = int(input())
	p = n // 2
	res = 0
	res1 = 0
	k = 1
	while k <= p:
		res1 = pow(2, k)
		res = res + res1
		k = k + 1
	print(res)


from collections import defaultdict, Counter
from functools import lru_cache
from heapq import heappush, heappop
from math import gcd, floor, ceil
from sys import stdin, stdout

def ilist():
	return [int(x) for x in stdin.readline().strip().split(' ')]

def iint():
	return int(stdin.readline().strip())

def istr():
	return stdin.readline().strip()

def solve(n):
	return (1 << n // 2 + 1) - 2
t = iint()
for _ in range(t):
	n = iint()
	print(solve(n))


import sys
n = int(input())
nums = [int(n.strip()) for n in sys.stdin.readlines()]
for c in nums:
	twos = [2 ** i for i in range(1, c + 1)]
	lt = len(twos)
	if lt == 2:
		print(twos[1] - twos[0])
	else:
		print(sum(twos[0:int(lt / 2) - 1] + twos[lt - 1:]) - sum(twos[int(lt / 2) - 1:-1]))


import math
T = int(input())
while T > 0:
	n = int(input())
	(a, b) = (pow(2, n), pow(2, n - 1))
	for i in range(1, n // 2):
		a = a + pow(2, i)
		b = b + pow(2, i + n // 2 - 1)
	print(int(math.fabs(a - b)))
	T -= 1


t = int(input())
for g in range(t):
	sumi = 0
	n = int(input())
	for i in range(1, n // 2):
		sumi += 2 ** i
	for i in range(n // 2, n):
		sumi -= 2 ** i
	sumi += 2 ** n
	print(sumi)


t = int(input())
for i in range(t):
	n = int(input())
	s = int(n / 2) - 1
	(a, b) = (2 ** n, 2 ** (n - 1))
	for j in range(s):
		a += 2 ** (j + 1)
		b += 2 ** (n - 2 - j)
	print(abs(a - b))


t = int(input())
for k in range(t):
	n = int(input())
	ans = 2 ** n
	res = 0
	for i in range(int(n / 2), n):
		res = res + int(2 ** i)
	for i in range(1, int(n / 2)):
		ans = ans + int(2 ** i)
	print(ans - res)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def solve():
	n = int(input())
	a = 1 << n
	b = 0
	for i in range(1, n):
		if i < n // 2:
			a += 1 << i
		else:
			b += 1 << i
	print(abs(a - b))
t = int(input())
for i in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	b = 2 ** n
	a = b // 2
	k = n - 2
	count1 = count2 = 1
	while k > 0:
		if a < b and count1 < n // 2 or count2 == n // 2:
			a = a + 2 ** k
			count1 = count1 + 1
		elif a > b and count2 < n // 2 or count1 == n // 2:
			b = b + 2 ** k
			count2 = count2 + 1
		else:
			pass
		k = k - 1
	if b > a:
		print(b - a)
	else:
		print(a - b)


t = int(input())
for _ in range(t):
	n = int(input())
	sum1 = 0
	sum2 = 0
	if n // 2 % 2 == 1:
		x = n // 2
		for i in range(1, n + 1):
			if i < x or i >= 2 * x:
				sum1 += 2 ** i
			else:
				sum2 += 2 ** i
	else:
		x = n // 2
		for i in range(1, n + 1):
			if i >= x and i < 2 * x:
				sum2 += 2 ** i
			else:
				sum1 += 2 ** i
	print(abs(sum1 - sum2))


N = int(input())
for i in range(N):
	a = int(input())
	A = [2 ** i for i in range(1, a + 1)]
	C = max(A) + sum(A[:a // 2 - 1])
	D = sum(A[a // 2 - 1:]) - max(A)
	print(abs(C - D))


li = []
li2 = []
for _ in range(int(input())):
	for i in range(int(input())):
		li.append(2 ** (i + 1))
	for i in range(int(len(li) / 2)):
		li2.append(li[len(li) - i - 2])
	for i in range(int(len(li) / 2)):
		li.remove(li2[i])
	print(sum(li) - sum(li2))
	li = []
	li2 = []


inp = int(input())
l = []
smallest = 0
largest = 0
for get_input in range(inp):
	inp1 = int(input())
	for num in range(1, inp1 + 1):
		l.append(2 ** num)
	largest += l[-1]
	l.remove(l[-1])
	for numb in range(int(inp1 / 2) - 1):
		largest += l[numb]
		l[numb] = 0
	for remain_num in l:
		smallest += remain_num
	print(largest - smallest)
	largest = 0
	smallest = 0
	l = []


for xyz in range(0, int(input())):
	n = int(input())
	if n == 2:
		print(2)
	else:
		s1 = 0
		s2 = 0
		x = 1
		for i in range(1, n // 2):
			s1 += 2 ** i
			x = i
		s1 += 2 ** n
		for i in range(x + 1, n):
			s2 += 2 ** i
		print(abs(s2 - s1))


t = int(input())
for z in range(t):
	n = int(input())
	x = pow(2, n - 1)
	y = 2
	temp1 = temp2 = n / 2
	sum2 = 0
	sum1 = 0
	sum1 = sum1 + pow(2, n)
	while temp1 > 0:
		sum2 = sum2 + x
		x = x / 2
		temp1 -= 1
	temp2 -= 1
	while temp2 > 0:
		sum1 = sum1 + y
		y = y * 2
		temp2 -= 1
	ans = abs(sum1 - sum2)
	print(int(ans))


from collections import defaultdict as dd
for _ in range(int(input())):
	n = int(input())
	a = b = 0
	for i in range(n // 2 - 1):
		a += 2 ** (i + 1)
	for i in range(n // 2, n):
		b += 2 ** i
	a += 2 ** n
	print(abs(a - b))


t = int(input())
for _ in range(t):
	n = int(input())
	m = n // 2
	a = 0
	for i in range(m - 1):
		a += 2 ** (i + 1)
	a += 2 ** n
	a1 = 0
	for i in range(m, n):
		a1 += 2 ** i
	print(abs(a - a1))


for i in range(int(input())):
	coins = int(input())
	coins /= 2
	h1 = 0
	h2 = 0
	for i in range(1, int(coins + 1)):
		h1 += 2 ** i
		h2 += 2 ** (i + 1)
	print(abs(h1 - h2))


no_of_test_cases = int(input())
inputs = []
for case in range(no_of_test_cases):
	n = int(input())
	inputs.append(n)
for value in inputs:
	n_per_pile = int(value / 2)
	weights = [2 ** x for x in range(1, value + 1)]
	a = sum(weights[-1:] + weights[:n_per_pile - 1])
	b = sum(weights) - a
	print(a - b)


n = int(input())
for i in range(n):
	p = int(input())
	a = 2 ** p
	b = 0
	for j in range(1, p):
		if j < p // 2:
			a += 2 ** j
		else:
			b += 2 ** j
	print(abs(a - b))


t = int(input())
for _ in range(t):
	n = int(input())
	calc = 2 ** (n // 2 + 1) - 2
	print(calc)


from sys import stdin, stdout
T = int(stdin.readline().strip())
for caso in range(T):
	n = int(stdin.readline().strip())
	x = 1
	b1 = 0
	b = 0
	a = []
	for i in range(n):
		a.append(2 ** x)
		x += 1
	for i in range(n // 2 - 1, n - 1):
		b1 += a[i]
	b = sum(a) - b1
	print(abs(b1 - b))


t = int(input())
for _ in range(t):
	n = int(input())
	total_sum = 2 ** (n + 1) - 2
	sum_r = 2 ** (n // 2) - 2 + 2 ** n
	print(abs(total_sum - 2 * sum_r))


def check(arr, n):
	a1 = sum(arr[:n - 1]) + arr[-1]
	a2 = sum(arr) - a1
	return abs(a1 - a2)
t = int(input())
while t:
	n = int(input())
	arr = [pow(2, i) for i in range(1, n + 1)]
	print(check(arr, n // 2))
	t -= 1


from sys import stdin, stdout

def f(n):
	ans = 0
	for i in range(1, int(n / 2)):
		ans += pow(2, i)
	ans += pow(2, n)
	for i in range(int(n / 2), n):
		ans -= pow(2, i)
	print(abs(ans))
t = int(stdin.readline())
for _ in range(t):
	n = int(input())
	f(n)


for i in [*open(0)][1:]:
	print((2 << int(i) // 2) - 2)


for _ in range(int(input())):
	n = int(input())
	r = 2 ** n
	l = 1
	for i in range(1, n, 1):
		if l <= n // 2 - 1:
			r += 2 ** i
		else:
			r -= 2 ** i
		l += 1
	print(r)


t = int(input())
b = []
for i in range(t):
	n = int(input())
	a = []
	for j in range(1, n + 1):
		a.append(2 ** j)
	d = n // 2 - 1
	if d > 0:
		c = a[n - 1]
		for h in range(d):
			c += a[h]
		for s in range(d, n - 1):
			c -= a[s]
	elif n == 3:
		c = a[2] - a[1] - a[0]
	else:
		c = a[1] - a[0]
	b.append(c)
for x in b:
	print(x)


n = int(input())
I = []
for i in range(n):
	k = int(input())
	I.append(k)

def output(x):
	(m, s, a) = ([], [], 0)
	for i in range(1, x + 1):
		m.append(2 ** i)
	(b, g) = (m[-1], x - x // 2 - 2)
	if x == 2:
		return abs(m[1] - m[0])
	else:
		for i in range(1, x // 2 + 1):
			a += m[-i - 1]
		for i in range(0, g + 1):
			b += m[i]
		return abs(b - a)
for i in range(n):
	print(output(I[i]))


for _ in range(int(input())):
	n = int(input())
	a = [2 ** i for i in range(1, n + 1)]
	pile1 = sum(a[:n // 2 - 1]) + a[-1]
	pile2 = sum(a) - pile1
	print(abs(pile1 - pile2))


n = int(input())
for i in range(n):
	k = int(input())
	ans = 2 ** k
	for j in range(1, k):
		if j < k // 2:
			ans += 2 ** j
		else:
			ans -= 2 ** j
	print(abs(ans))


def Balance(n):
	li = [2 ** i for i in range(1, n + 1)]
	i = 0
	lsum = li[n - 1]
	rsum = 0
	while i < n // 2 - 1:
		lsum += li[i]
		i += 1
	j = n // 2 - 1
	while j < n - 1:
		rsum += li[j]
		j += 1
	return abs(lsum - rsum)
for i in range(int(input())):
	n = int(input())
	print(Balance(n))


def solve(a, n):
	sum = 0
	for i in range(n // 2 - 1):
		sum += a[i]
	sum += a[n - 1]
	diff = 0
	for i in range(n // 2 - 1, n - 1):
		diff += a[i]
	return abs(sum - diff)
t = int(input())
for _ in range(t):
	n = int(input())
	a = [2 ** i for i in range(1, n + 1)]
	if n > 2:
		print(solve(a, n))
	else:
		print(2)


nrew = int(input())
for wew in range(nrew):
	n = int(input())
	temp = []
	for p in range(n):
		temp.append(pow(2, p + 1))
	ans = 0
	if len(temp) == 0:
		break
	if len(temp) == 2:
		ans += temp[1] - temp[0]
	else:
		ans += temp[len(temp) - 1] + temp[0] - temp[len(temp) - 2] - temp[len(temp) - 3]
		temp.pop(len(temp) - 1)
		temp.pop(len(temp) - 1)
		temp.pop(len(temp) - 1)
		temp.pop(0)
		r1 = 0
		r2 = 0
		while True:
			if len(temp) == 0:
				break
			else:
				r1 += temp[0]
				r2 += temp[len(temp) - 1]
				temp.pop(len(temp) - 1)
				temp.pop(0)
		ans += r1 - r2
	print(ans)


t = int(input())
result = []
for _ in range(t):
	n = int(input())
	half = int(n / 2)
	coins = [pow(2, x) for x in range(1, n + 1)]
	first = coins[:-1][-half:]
	second = list(set(coins) - set(first))
	result.append(abs(sum(first) - sum(second)))
for res in result:
	print(res)


for x in range(int(input())):
	n = int(input())
	max = pow(2, n)
	sum1 = 0
	sum2 = 0
	i = 1
	while i < n / 2:
		sum1 += pow(2, i)
		i += 1
	i = n / 2
	while i < n:
		sum2 += pow(2, i)
		i += 1
	print(int(abs(max + sum1 - sum2)))


for _ in range(int(input())):
	l = []
	for i in range(1, int(input()) + 1):
		l.append(2 ** i)
	s = sum(l[:len(l) // 2 - 1]) + l[-1]
	print(abs(sum(l) - 2 * s))


dp = [2 ** i for i in range(31)]
q = int(input())
for _ in range(q):
	n = int(input())
	s = 0
	for i in range(1, n + 1):
		s += dp[i]
	a = dp[n]
	for i in range(1, n // 2):
		a += dp[i]
	b = s - a
	print(abs(a - b))


from functools import reduce
import os
import sys
from collections import *
from math import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
for _ in range(inn()):
	n = inn()
	a = []
	sm = 0
	for i in range(1, n + 1):
		a += [2 ** i]
	for i in range(n - 1, n - 1 - n // 2, -1):
		sm += a[i]
	print(sum(a) - sm)


def main():
	for tin in range(int(input())):
		n = int(input())
		a = []
		x = 0
		y = 0
		for _ in range(1, n + 1):
			a.append(2 ** _)
		if n == 2:
			print(abs(a[0] - a[1]))
		else:
			for _ in range(n // 2 - 1):
				x += a[_]
				a[_] = 0
			x += a[-1]
			a[-1] = 0
			y = sum(a)
			print(abs(x - y))
main()


t = int(input())
for i in range(t):
	n = int(input())
	arr = [2 ** j for j in range(1, n + 1)]
	sum1 = 0
	sum2 = 0
	if n == 2:
		print(arr[1] - arr[0])
		continue
	k = 0
	l = n - 1
	sum1 = arr[l] + sum(arr[:len(arr) // 2 - 1])
	sum2 = sum(arr[len(arr) // 2 - 1:n - 1])
	print(abs(sum2 - sum1))


def main():
	n = int(input())
	for i in range(n):
		m = int(input())
		a = 0
		b = 0
		sa = 0
		sb = 0
		for j in range(m, 0, -1):
			if sa > sb and b < m // 2 or a == m // 2:
				sb += 2 ** j
				b += 1
			else:
				sa += 2 ** j
				a += 1
		print(abs(sa - sb))
main()


import sys
import math
input = sys.stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	s = 2 ** n
	for i in range(n // 2):
		s -= 2 ** (n - 1 - i)
	for i in range(n // 2 - 1):
		s += 2 ** (i + 1)
	print(s)


import math
test = int(input())
for t in range(test):
	n = int(input())
	l1 = [2 ** n]
	l2 = []
	count1 = 1
	k = 1
	while count1 != n // 2:
		l1.append(2 ** k)
		k += 1
		count1 += 1
	while len(l2) != n // 2:
		l2.append(2 ** k)
		k += 1
	print(abs(sum(l1) - sum(l2)))


for q in range(int(input())):
	n = int(input())
	s = 0
	for i in range(1, n // 2):
		s += 2 ** i
	s += 2 ** n
	for i in range(n // 2, n):
		s -= 2 ** i
	print(abs(s))


nbTests = int(input())
for i in range(nbTests):
	nbPieces = int(input())
	a = 0
	b = 0
	for j in range(int(nbPieces / 2), nbPieces):
		b += 2 ** j
	a += 2 ** nbPieces
	for j in range(1, int(nbPieces / 2)):
		a += 2 ** j
	print(abs(a - b))


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	l = []
	for j in range(n):
		l.append(2 ** (j + 1))
	half = n // 2
	left = l[-1]
	for m in range(half - 1):
		left += l[m]
	right = 0
	for h in range(half - 1, n - 1):
		right += l[h]
	ans.append(abs(left - right))
for item in ans:
	print(item)


for T in range(int(input())):
	n = int(input())
	arr = [pow(2, i) for i in range(1, n + 1)]
	v1 = 0
	for i in range(n // 2 - 1):
		v1 += arr[i]
	v1 += arr[n - 1]
	v2 = 0
	for i in range(n // 2 - 1, n - 1):
		v2 += arr[i]
	print(abs(v1 - v2))


import math
import operator

def AcDegaYe():
	n = int(input())
	li = [pow(2, i + 1) for i in range(n)]
	a = li[n - 1]
	for i in range(int(n / 2) - 1):
		a += li[i]
	b = 0
	for i in range(int(n / 2) - 1, n - 1):
		b += li[i]
	print(a - b)
t = int(input())
for _ in range(t):
	AcDegaYe()


x = [2 ** (i + 1) for i in range(30)]
for i in range(int(input())):
	n = int(input())
	t = x[:n]
	if n == 2:
		print(2)
		continue
	a = sum(t[:n // 2 - 1]) + t[-1]
	b = sum(t[n // 2 - 1:-1])
	print(abs(a - b))


t = int(input())
for i in range(t):
	n = int(input())
	a1 = 2 ** n
	a2 = 0
	j = 1
	k = n // 2
	for j in range(1, k):
		a1 = a1 + 2 ** j
	for j in range(k, n):
		a2 = a2 + 2 ** j
	print(a1 - a2)


for _ in range(int(input())):
	n = int(input())
	r = n / 2
	x = 1
	p = 0
	while x < r:
		p += 2 ** x
		x += 1
	a = p + 2 ** n
	k = 0
	while r < n:
		k += 2 ** r
		r += 1
	b = k
	j = int(abs(a - b))
	print(j)


t = int(input())
for i in range(t):
	n = int(input())
	numbers = [2 ** i for i in range(1, n + 1)]
	numbers.insert(0, 0)
	pile1 = 0
	pile2 = 0
	i = 1
	pile1 = numbers.pop()
	pile2 = 0
	while len(numbers) != 2:
		pile1 += numbers.pop(1)
		pile2 += numbers.pop()
	pile2 += numbers.pop()
	print(abs(pile1 - pile2))


liss = [2 ** i for i in range(1, 32)]
for x in range(int(input())):
	n = int(input())
	ans = abs(sum(liss[0:n // 2 - 1]) + liss[n] - sum(liss[n // 2 - 1:n]))
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	sum1 = 2 ** (n / 2) + 2 ** n - 2
	sum2 = 2 ** n - 2 ** (n / 2)
	print(int(sum1 - sum2))


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	l1 = [l[-1]]
	for i in range(0, n // 2 - 1):
		l1.append(l[i])
	l2 = list(set(l) - set(l1))
	print(sum(l1) - sum(l2))


import math

def value(n):
	x = []
	for i in range(1, n + 1):
		c = 2 ** i
		x.append(c)
	return x
t = int(input())
for i in range(0, t):
	n = int(input())
	x = value(n)
	d = n / 2
	e = sum(x[int(d - 1):int(2 * d - 1)])
	f = sum(x) - e
	f = f - e
	f = math.fabs(f)
	print(int(f))


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for j in range(1, n + 1):
		l.append(2 ** j)
	d = sum(l[n // 2 - 1:-1]) - (sum(l[:n // 2 - 1]) + l[-1])
	print(abs(d))


import sys

def readint():
	return int(sys.stdin.readline().rstrip())

def solve(t):
	n = readint()
	print(2 * ((1 << n - 1) - ((1 << n // 2) - 1 << n // 2 - 1) + (1 << n // 2 - 1) - 1))

def main():
	T = readint()
	for t in range(1, T + 1):
		solve(t)
main()


for _ in range(int(input())):
	n = int(input())
	(arr, exp) = ([0, 0], n)
	while exp > 0:
		arr[exp >= n // 2 and exp < n] += 2 ** exp
		exp -= 1
	print(arr[0] - arr[1])


for _ in range(int(input())):
	a = int(input())
	print(2 ** (a // 2 + 1) - 2)


k = int(input())
for i in range(k):
	n = int(input())
	power = n // 2 + 1
	print(abs(2 ** power - 2))


def solve():
	n = int(input())
	s = 2 ** n - 2
	l = s - 2 ** (n / 2) + 2
	r = 2 ** (n + 1) - 2 - l
	print(int(abs(l - r)))

def main():
	t = int(input())
	for i in range(t):
		solve()
main()


def solution():
	from sys import stdout, stdin
	arr = [2 ** i for i in range(1, 31)]
	summary = []
	for i in range(30):
		if i == 0:
			summary.append(2)
		else:
			summary.append(summary[-1] + arr[i])
	(_input, _print) = (stdin.readline, stdout.write)
	for _ in range(int(input())):
		n = int(input())
		left = sum(arr[n // 2 - 1:n - 1])
		right = summary[n - 1] - left
		print(right - left)
solution()


n = int(input())
for i in range(n):
	t = int(input())
	if t == 2:
		print(2)
	else:
		a = [2 ** x for x in range(1, t + 1)]
		print(a[-1] + sum(a[:t // 2 - 1]) - sum(a[t // 2 - 1:-1]))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = []
	for i in range(1, n + 1):
		arr += [2 ** i]
	first = [arr[-1]]
	arr.remove(arr[-1])
	i = 0
	while len(first) != n // 2:
		first += [arr[0]]
		arr.remove(arr[0])
	print(sum(first) - sum(arr))


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2:
		print(2)
		continue
	a = [2 ** i for i in range(1, n + 1)]
	a1 = a[-1] + sum(a[:n // 2 - 1])
	a2 = sum(a) - a1
	print(abs(a2 - a1))


t = int(input())
import itertools
for _ in range(t):
	n = int(input())
	t1 = 0
	t2 = 0
	for i in range(1, n + 1):
		if i < n // 2:
			t1 += 2 ** i
		elif n // 2 <= i < n:
			t2 += 2 ** i
		else:
			t1 += 2 ** i
	print(abs(t1 - t2))


t = int(input())
for i in range(t):
	n = int(input())
	(p, q) = (pow(2, n), 0)
	for i in range(1, n):
		if i * 2 < n:
			p += pow(2, i)
		else:
			q += pow(2, i)
	print(abs(p - q))


twos = [2]
for i in range(1, 31):
	twos.append(twos[-1] * 2)
for _ in range(int(input())):
	nb = int(input())
	sum1 = sum([1 << x for x in range(1, nb // 2)])
	sum1 += 1 << nb
	sum2 = sum([1 << x for x in range(nb // 2, nb)])
	print(sum1 - sum2)


pows2 = [2 ** i for i in range(31)]
for _ in range(int(input())):
	n = int(input())
	print(pows2[n // 2 + 1] - 2)


tc = int(input())
for _ in range(tc):
	n = int(input())
	half = n // 2
	arr = [2 ** i for i in range(1, n + 1)]
	a = []
	a.append(arr.pop(-1))
	for k in range(0, half - 1):
		a.append(arr.pop(0))
	print(abs(sum(a) - sum(arr)))


from sys import stdin
N = int(stdin.readline())
for case in range(N):
	n = int(stdin.readline())
	sums = 2 ** (n + 1) - 2
	sum2 = 0
	for i in range(n - 1, n // 2 - 1, -1):
		sum2 += 2 ** i
	print(abs(sums - 2 * sum2))


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	n = int(data())
	s1 = pow(2, n)
	for i in range(1, n // 2):
		s1 += pow(2, i)
	s2 = 0
	for i in range(n // 2, n):
		s2 += pow(2, i)
	out(abs(s1 - s2))


t = int(input())
d = [1]
k = 2
for _ in range(30):
	d.append(k)
	k = k * 2
for _ in range(t):
	n = int(input())
	a = int(d[n])
	b = int(d[n - 1])
	n = n - 2
	for i in range(1, n // 2 + 1):
		a += d[i]
	for i in range(n // 2 + 1, n + 1):
		b += d[i]
	print(abs(a - b))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import time, random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	na = [I() for _ in range(t)]
	ii = [2 ** i for i in range(1, 40)]
	rr = []
	for n in na:
		s = sum(ii[:n])
		a = ii[n - 1] + sum(ii[:n // 2 - 1])
		rr.append(a * 2 - s)
	return JA(rr, '\n')
print(main())


for _ in range(int(input())):
	n = int(input())
	ps = [[], []]
	for (i, c) in enumerate(range(1, n)):
		if i + 1 >= n / 2:
			ps[0].append(2 ** c)
		else:
			ps[1].append(2 ** c)
	ps[1].append(2 ** n)
	print(abs(sum(ps[1]) - sum(ps[0])))


t = int(input())
for _ in range(t):
	n = int(input())
	c = []
	for i in range(n):
		m = 2 ** (i + 1)
		c.append(m)
	total = sum(c)
	pile1 = c[0]
	if n // 2 >= 2:
		pile1 += c[n - 1]
	for i in range(n // 2 - 2):
		pile1 += c[i + 1]
	pile2 = total - pile1
	print(abs(pile2 - pile1))


def main():
	a = int(input())
	for i in range(a):
		b = int(input())
		cout = 0
		f = 1
		s = b
		cnt = 0
		cnt_a = 0
		for i in range(b):
			cnt_a += 2 ** (i + 1)
		while cnt < cnt_a - cnt and cout != b / 2:
			cout += 1
			if cout % 2 == 1:
				cnt += 2 ** f
				f += 1
			else:
				cnt += 2 ** s
				s -= 1
		while cout != b / 2:
			cout += 1
			cnt += 2 ** f
			f += 1
		print(abs(abs(cnt_a - cnt) - cnt))
main()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = b = 0
	for i in range(1, n + 1):
		if i == n:
			a += 2 ** i
		elif i < n / 2:
			a += 2 ** i
		else:
			b += 2 ** i
	print(abs(a - b))


import math
t = int(input())
A = []
B = []
C = []
for i in range(t):
	n = int(input())
	A.clear()
	B.clear()
	C.clear()
	while n > 0:
		A.append(2 ** n)
		n = n - 1
	A.reverse()
	k = int(A[-1])
	if len(A) == 2:
		print(A[-1] - A[0])
	else:
		for i in range(len(A) - 1):
			if i < len(A) / 2 - 1:
				B.append(A[i])
			else:
				C.append(A[i])
		print(sum(B) + k - sum(C))


for i in range(int(input())):
	x = int(input())
	y = 0
	if x == 2:
		print('2')
	else:
		for j in range(0, x // 2 - 1):
			y += 2 ** (j + 1)
		y += 2 ** x
		for j in range(x // 2, x):
			y = y - 2 ** j
		print(y)


t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	brr = []
	for j in range(1, n // 2):
		arr.append(2 ** j)
	for j in range(n // 2, n):
		brr.append(2 ** j)
	arr.append(2 ** n)
	print(sum(arr) - sum(brr))


import sys
from collections import defaultdict
input = sys.stdin.readline

def print_result(l):
	return print(' '.join(map(str, l)))

def timer(function):
	import time

	def wrapper(*args, **kwargs):
		t1 = time.time()
		val = function()
		t2 = time.time()
		print('Executed \\{}\\ in {:.2f} seconds.'.format(function.__name__, t2 - t1))
		return val
	return wrapper

def solve():
	n = int(input())
	assert n % 2 == 0
	min_sum = 2 ** n + sum([2 ** i for i in range(1, n // 2)]) - sum([2 ** i for i in range(n // 2, n)])
	print(min_sum)
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	po = n // 2
	print(2 * (2 ** po - 2) + 2)


for _ in range(int(input())):
	big = []
	low = []
	ans = []
	n = int(input())
	mid = n // 2
	for i in range(1, mid):
		big.append(2 ** i)
	big.append(2 ** n)
	for i in range(mid, n):
		low.append(2 ** i)
	print(abs(sum(big) - sum(low)))


t = int(input())
for _ in range(t):
	n = int(input())
	x = n // 2
	summ = 0
	carry = 0
	for i in range(1, n + 1):
		if i == n or i <= x - 1:
			summ += 2 ** i
		else:
			carry += 2 ** i
	print(abs(summ - carry))


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print(2)
	else:
		otv1 = 2 ** n + 2 * (2 ** (n // 2 - 1) - 1)
		otv2 = 2 * (2 ** n - 1) - otv1
		print(abs(otv1 - otv2))


for _ in range(int(input())):
	n = int(input())
	a = []
	for i in range(1, n + 1):
		a.append(2 ** i)
	a1 = [a[-1]]
	a2 = []
	for i in range(n // 2 - 1):
		a1.append(a[i])
	for i in range(n // 2 - 1, n - 1):
		a2.append(a[i])
	print(sum(a1) - sum(a2))


t = int(input())
for i in range(t):
	n = int(input())
	key = [x for x in range(1, int(n / 2 + 2))]
	d = dict([(k, []) for k in key])
	for j in range(1, int(n / 2 + 2)):
		d[j] = abs(pow(2, n / 2 + j) - pow(2, j) - pow(2, n) + 1)
	d2 = sorted(d.items(), key=lambda x: x[1], reverse=False)
	print(int(2 * abs(pow(2, n / 2 + d2[0][0]) - pow(2, d2[0][0]) - pow(2, n) + 1)))


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print(2)
	elif n == 4:
		print(6)
	else:
		a = 0
		for j in range(1, n // 2 + 1):
			a = a + 2 ** j
		print(a)


T = int(input())
for i in range(T):
	b = []
	sum1 = 0
	a = int(input())
	for i in range(1, a + 1):
		c = 2 ** i
		b.append(c)
	divide = a // 2
	for i in range(divide):
		sum1 = sum1 + b[i]
	print(sum1)


potegi = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768]
for x in range(int(input())):
	print((potegi[int(input()) // 2] - 1) * 2)


import math
for _ in range(int(input())):
	n = int(input())
	ans1 = []
	ans2 = []
	for i in range(n // 2 - 1):
		ans1.append(2 ** (i + 1))
	ans1.append(2 ** n)
	for i in range(n // 2 - 1, n - 1):
		ans2.append(2 ** (i + 1))
	print(abs(sum(ans1) - sum(ans2)))


import math
t = int(input())
while t > 0:
	n = int(input())
	print(int(abs(2 * math.pow(2, n / 2) - 2)))
	t = t - 1


def RA():
	return list(map(int, input().split()))

def s(n):
	return (1 << n + 1) - 2

def solve():
	n = int(input())
	print(2 * s(n // 2 - 1) + 2)
t = int(input())
for i in range(t):
	solve()


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	n = mint()
	print(2 * (2 ** (n // 2) - 1))
for i in range(mint()):
	solve()


no = int(input())
j = []
for r in range(no):
	weights = []
	n = int(input())
	for each in range(1, n + 1):
		weights.append(pow(2, each))
	ans = sum(weights[:n // 2])
	j.append(ans)
for r in j:
	print(r)


for i in range(int(input())):
	n = int(input())
	c1 = 0
	c2 = 0
	for z in range(1, int(n / 2)):
		c1 += 2 ** z
	c1 += 2 ** n
	for j in range(int(n / 2), n):
		c2 += 2 ** j
	print(abs(c1 - c2))


q = int(input())
for i in range(q):
	x = int(input())
	arr = []
	b = []
	for i in range(1, x + 1):
		arr.append(2 ** i)
	for i in range(x // 2 - 1):
		b.append(arr.pop(0))
	b.append(arr.pop())
	print(abs(sum(b) - sum(arr)))


cases = int(input(''))
counter = 0
list1 = []
output = []
for case in range(cases):
	x = int(input(''))
	y = 2 ** x
	for c in range(1, 100):
		list1.append(2 ** c)
		if 2 ** c == y:
			break
	counter = list1[len(list1) - 1]
	for c in range(int(len(list1) / 2)):
		counter -= list1[len(list1) - 2 - c]
		if c < len(list1) / 2 - 1:
			counter += list1[c]
	output.append(counter)
	list1.clear()
	counter = 0
print(*output, sep='\n')


for i in range(int(input())):
	n = int(input())
	select = n / 2 - 1
	diff = 2
	total = 2 * (pow(2, select + 1) - 2)
	diff += total
	print(int(diff))


t = int(input())
for _ in range(t):
	a = int(input())
	n = a // 2
	difference = 2 * (2 ** n - 1)
	print(difference)


n = int(input())
a = []
for i in range(1, n + 1):
	s = int(input())
	tot = 0
	for j in range(1, int(s / 2) + 1):
		tot = tot + 2 ** j
	a.append(tot)
for i in a:
	print(i)


t = int(input())
for i in range(t):
	n = int(input())
	left = []
	right = []
	for j in range(1, n // 2):
		left.append(2 ** j)
	left.append(2 ** n)
	for j in range(n // 2, n):
		right.append(2 ** j)
	print(abs(sum(left) - sum(right)))


for _ in range(int(input())):
	n = int(input())
	coins = [2 ** n for n in range(1, n + 1)]
	first_sum = coins[-1] + sum(coins[:n // 2 - 1])
	second_sum = sum(coins[n // 2 - 1:-1])
	print(first_sum - second_sum)


x = int(input())
input_list = []
for i in range(x):
	input_list.append(int(input()))
for i in range(x):
	if input_list[i] == 2:
		print(2)
	else:
		n = input_list[i]
		main_array = [2 ** j for j in range(1, n)]
		print(sum(main_array[:n // 2 - 1] + [2 ** n]) - sum(main_array[n // 2 - 1:]))


def solution():
	n = int(input())
	s1 = s2 = 0
	for i in range(1, n // 2):
		s1 += 2 ** i
	s1 += 2 ** n
	s = 2 * (2 ** n - 1)
	s2 = s - s1
	print(abs(s1 - s2))
for _ in range(int(input())):
	solution()


def a():
	n = int(input())
	arr = [2 ** i for i in range(1, n + 1)]
	if n == 2:
		print(2)
	else:
		elem1 = arr[-1]
		k = n // 2
		for i in range(k - 1):
			elem1 += arr[i]
		tot = sum(arr)
		print(abs(tot - 2 * elem1))
t = int(input())
for i in range(t):
	a()


for n in range(int(input())):
	x = int(input())
	a = 1 << x
	b = 1 << x - 1
	for n in range(1, x - 1):
		if n < x // 2:
			a += 1 << n
		else:
			b += 1 << n
	print(a - b)


t = int(input())
for i in range(t):
	a = []
	b = []
	n = int(input())
	for j in range(1, n + 1):
		a.append(2 ** j)
	val = a.pop()
	a.insert(0, val)
	b = a[:n // 2]
	a = a[n // 2:]
	print(abs(sum(b) - sum(a)))


def sum(n):
	return 2 ** (n + 1) - 2
T = int(input())
for i in range(T):
	n = int(input())
	ans = 2 ** n + sum(n / 2 - 1) - (sum(n - 1) - sum(n / 2 - 1))
	print(int(ans))


M = lambda : list(map(int, input().split()))
for i in range(int(input())):
	n = int(input())
	print(2 + 2 * sum([2 ** i for i in range(1, n // 2)]))


import math
import atexit
import io
import sys
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def array_to_string(a):
	s = ''
	for i in a:
		s += str(i) + ' '
	return s[0:len(s) - 1]

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = [2 ** i for i in range(1, n + 1)]
	s1 = 0
	s2 = 0
	half = n // 2
	s1 = sum(a[0:half - 1]) + a[-1]
	s2 = sum(a) - s1
	print(abs(s2 - s1))


t = int(input())
for i in range(t):
	n = int(input())
	pile1 = 2 ** n
	pile2 = 0
	for j in range(1, n // 2):
		pile1 = pile1 + 2 ** j
	for j in range(n // 2, n):
		pile2 += 2 ** j
	print(pile1 - pile2)


t = int(input())
while t:
	n = int(input())
	half = n // 2
	total1 = 0
	total2 = 0
	for i in range(1, n + 1):
		total1 += pow(2, i)
	for i in range(half, n):
		total2 += pow(2, i)
	t = t - 1
	print(total1 - 2 * total2)


t = int(input())
for k in range(t):
	n = int(input())
	l1 = []
	l2 = []
	for i in range(int(n / 2)):
		t = pow(2, i + 1)
		l1.append(t)
	for j in range(int(n / 2), n):
		T = pow(2, j + 1)
		l2.append(T)
	if n == 2:
		print('2')
	else:
		x = len(l1)
		y = len(l2)
		a = l1[x - 1]
		b = l2[y - 1]
		l1.remove(l1[x - 1])
		l2.remove(l2[y - 1])
		l1.append(b)
		l2.append(a)
		s1 = sum(l1)
		s2 = sum(l2)
		s = abs(s1 - s2)
		print(s)


T = int(input())
for _ in range(T):
	n = int(input())
	total = sum((2 ** (i + 1) for i in range(n)))
	a = 2 ** n + sum((2 ** (i + 1) for i in range(n // 2 - 1)))
	b = total - a
	print(abs(a - b))


t = int(input())
import math
delay = []
for _ in range(t):
	n = int(input())
	print(2 ** (n // 2 + 1) - 2)


for _ in range(int(input())):
	n = int(input())
	pro = 1
	l = []
	for i in range(n):
		pro = pro * 2
		l.append(pro)
	a = []
	b = []
	a.append(l[n - 1])
	for i in range(n // 2 - 1):
		a.append(l[i])
	for i in range(n // 2 - 1, n - 1):
		b.append(l[i])
	print(sum(a) - sum(b))


t = int(input())
for test in range(t):
	n = int(input())
	if n == 2:
		print(2)
		continue
	i = 1
	j = n
	a = 0
	b = 0
	a += 2 ** j
	j -= 1
	b += 2 ** j
	j -= 1
	to_take = n // 2 - 1
	while to_take > 0:
		a += 2 ** i
		i += 1
		b += 2 ** j
		j -= 1
		to_take -= 1
	print(abs(a - b))


t = int(input())
while t > 0:
	num = int(input())
	n = num // 2 + 1
	res = 2 ** n - 2
	print(res)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	f = n // 2
	a = 2 ** n + (2 ** f - 2)
	b = 0
	for i in range(n // 2, n):
		b += 2 ** i
	print(abs(a - b))


from math import floor, log2
for _ in range(int(input())):
	n = int(input())
	if n == 2:
		print(2)
	else:
		n = n // 2
		res = 0
		for i in range(1, n + 1):
			res += 2 ** i
		print(res)


t = int(input())
for i in range(t):
	n = int(input())
	a = [2 ** i for i in range(1, n + 1)]
	s1 = a[-1] + sum(a[:n // 2 - 1])
	s2 = sum(a[n // 2 - 1:-1])
	print(abs(s1 - s2))


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	for i in range(1, n + 1):
		a.append(2 ** i)
	c = a[n - 1]
	d = 0
	for i in range(0, int(n / 2) - 2 + 1):
		c = c + a[i]
	for i in range(int(n / 2) - 1, n - 1):
		d = d + a[i]
	print(abs(c - d))


for _ in range(int(input())):
	n = int(input())
	m = pow(2, n)
	for i in range(1, n // 2):
		m += pow(2, i)
	for i in range(n // 2, n):
		m -= pow(2, i)
	print(m)


t = int(input())
while t > 0:
	n = int(input())
	lst = list()
	for i in range(n):
		lst.append(pow(2, i + 1))
	if n == 2:
		print(abs(lst[0] - lst[1]))
		t -= 1
		continue
	leftpile = 0
	rightpile = 0
	leftpile = lst[n - 1]
	for i in range(0, n // 2 - 1):
		leftpile += lst[i]
	for i in range(n // 2 - 1, n - 1):
		rightpile += lst[i]
	print(abs(leftpile - rightpile))
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [2 ** (i + 1) for i in range(n)]
	p1 = arr[:n // 2 - 1] + arr[-1:]
	p2 = arr[n // 2 - 1:-1]
	r = abs(sum(p1) - sum(p2))
	print(r)


k = int(input())
for j in range(k):
	t = int(input())
	l1 = []
	for i in range(t):
		l1.append(int(2 ** (i + 1)))
	sum1 = 0
	sum2 = 0
	if t == 2:
		print('2')
	else:
		sum1 = sum(l1[0:t // 2 - 1]) + l1[t - 1]
		sum2 = sum(l1[t // 2 - 1:t - 1])
		print(sum1 - sum2)


for _ in range(int(input())):
	n = int(input())
	m = n // 2
	a = []
	for i in range(1, n + 1):
		a.append(2 ** i)
	a.sort(reverse=True)
	p1 = []
	p2 = []
	p2 = a[1:m + 1]
	p1 = a[m + 1:n]
	p1.append(a[0])
	s1 = sum(p1)
	s2 = sum(p2)
	print(abs(s1 - s2))


test_case = int(input())
for _ in range(test_case):
	n = int(input())
	l = list()
	for i in range(1, n + 1):
		l.append(1 << i)
	x = sum(l[n // 2 - 1:n - 1])
	s = sum(l[:n // 2 - 1]) + l[-1]
	print(s - x)


t = int(input())
for numtests in range(t):
	n = int(input())
	print(str(int(2 ** (n / 2 + 1) - 2)))


for i in range(int(input())):
	n = int(input())
	if n == 2:
		print(2)
	else:
		l = []
		for j in range(1, n + 1):
			l.append(2 ** j)
		(a, b) = (l[-1], l[-2])
		x = n // 2 - 1
		for j in range(x):
			a += l[j]
			b += l[j + x]
		print(abs(a - b))


import math

def solve(coins):
	sum_first = math.pow(2, coins)
	sum_second = 0
	for i in range(1, int(coins / 2), 1):
		sum_first += math.pow(2, i)
	for i in range(int(coins / 2), coins, 1):
		sum_second += math.pow(2, i)
	print(int(sum_first - sum_second))
testCases = int(input())
while testCases:
	N = int(input())
	solve(N)
	testCases -= 1


for x in range(int(input())):
	n = int(input())
	k = 0
	for i in range(n // 2 - 1):
		k += 2 ** (i + 1)
	k += 2 ** n
	s = 0
	for i in range(n // 2, n):
		s += 2 ** i
	print(abs(k - s))


cases = int(input())
for i in range(cases):
	n = int(input())
	arr = []
	for a in range(1, n + 1):
		arr.append(2 ** a)
	num = int(n / 2) - 1
	s1 = 0
	for b in range(len(arr)):
		if num == 0:
			break
		s1 += arr[b]
		num -= 1
		arr[b] = 0
	s1 += arr[-1]
	arr[-1] = 0
	s2 = sum(arr)
	print(abs(s2 - s1))


te = int(input())
while te > 0:
	n = int(input())
	o = 0
	t = 0
	a = 2
	for i in range(n - n // 2 - 1):
		o += a
		a *= 2
	for i in range(n // 2):
		t += a
		a *= 2
	o += a
	print(abs(o - t))
	te -= 1


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in input().rstrip()]
for _ in range(val()):
	n = val()
	a = 2 ** n
	for i in range(1, n // 2):
		a += 2 ** i
	b = 0
	for i in range(n // 2, n):
		b += 2 ** i
	print(abs(a - b))


T = int(input())
number_of_twos = []
for i in range(1, 31):
	number_of_twos.append(2 ** i)
count = 0
for i in number_of_twos:
	count += 1
answer = 0
while T != 0:
	n = int(input())
	first_half = []
	fh_c = 0
	sh_c = n
	second_half = []
	half = int(n / 2)
	half2 = half
	first_half.append(number_of_twos[n - 1])
	while half != n:
		second_half.append(number_of_twos[half - 1])
		half += 1
	while fh_c != half2 - 1:
		first_half.append(number_of_twos[fh_c])
		fh_c += 1
	print(sum(first_half) - sum(second_half))
	T -= 1


import math
T = int(input())
for t in range(T):
	n = int(input())
	x = int(2 ** (n / 2 + 1))
	print(x - 2)


import math
MOD = 1000003

def solve(n):
	if n == 2:
		print(2)
	else:
		(sum1, sum2) = (0, 0)
		a = [math.pow(2, x) for x in range(1, n + 1)]
		(sum1, sum2) = (a[n - 2], a[n - 1])
		for i in range(0, n - 2):
			if i < (n - 2) // 2:
				sum2 += a[i]
			else:
				sum1 += a[i]
		print(int(sum2 - sum1))
for i in range(int(input())):
	n = int(input())
	solve(n)


t = int(input())
for i in range(t):
	n = int(input())
	s = 2 ** n
	m = 0
	if n > 2:
		for j in range(1, (n - 2) // 2 + 1):
			s += 2 ** j
		for j in range((n - 2) // 2 + 1, n):
			m += 2 ** j
		print(s - m)
	else:
		print(2)


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	n = int(input())
	print((1 << n // 2 + 1) - 2)


a = int(input())
for i in range(0, a):
	b = int(input())
	c = int(b / 2)
	sm = 2 ** (b + 1) - 2
	aa = b - 1
	for j in range(0, c):
		sm -= 2 * 2 ** (b - 1 - j)
	print(abs(sm))


answer = []
for i in range(int(input())):
	sum = 0
	a = []
	n = int(input())
	for j in range(1, n + 1):
		a.append(2 ** j)
	x = 2 * (2 ** (n / 2 - 1) - 1)
	y = x + a[-1]
	z = 2 * (2 ** (n - 1) - 1) - x
	sum = abs(y - z)
	answer.append(int(sum))
for i in range(len(answer)):
	print(answer[i])


from collections import Counter
import math
mod = 10 ** 9 + 7
for i in range(int(input())):
	n = int(input())
	x = 2 ** n
	y = 0
	for i in range(n // 2):
		y += 2 ** (n - i - 1)
	for i in range(n // 2 - 1):
		x += 2 ** (i + 1)
	print(abs(x - y))


def calc(num):
	(a, b) = (0, 0)
	z = 2
	for i in range(num // 2 - 1):
		a += z
		z *= 2
	for i in range(num // 2 - 1, num - 1):
		b += z
		z *= 2
	return z + a - b
t = int(input())
for i in range(1, t + 1):
	nl = int(input())
	result = calc(nl)
	print(result)


import sys
input = lambda : sys.stdin.readline().strip()
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = 0
	b = 2 ** n
	for i in range(0, n // 2 - 1):
		b += 1 << i + 1
	for i in range(n // 2 - 1, n - 1):
		a += 1 << i + 1
	print(abs(a - b))


a = int(input())
for ijfof in range(a):
	n = int(input())
	pile1 = 0
	pile2 = 0
	pile1 = pile1 + 2 ** n
	count = int(n / 2 - 1)
	for i in range(1, count + 1):
		pile1 = pile1 + 2 ** i
	pile2 = 2 ** (n + 1) - 2 - pile1
	print(int(abs(pile1 - pile2)))


for _ in range(int(input())):
	n = int(input())
	l = []
	for i in range(1, n + 1):
		l.append(2 ** i)
	i = 0
	si = sum(l)
	m = 100000000000000000000
	while i + n // 2 < n:
		s = sum(l[i:i + n // 2])
		m = min(m, abs(si - s - s))
		i += 1
	print(m)


for i in range(int(input())):
	b = int(input())
	value = 2 ** ((b + 2) // 2) - 2
	print(value)


t = int(input())
for i in range(t):
	n = int(input())
	k1 = 0
	d = 2
	for j in range(n // 2 - 1):
		k1 += d
		d *= 2
	k2 = 0
	for j in range(n // 2):
		k2 += d
		d *= 2
	k1 += d
	print(k1 - k2)


def pab(n):
	if n == 2:
		print(2)
		return
	l1 = []
	l2 = []
	l1.append(2 ** n)
	p = n - 1
	q = int(n / 2)
	for i in range(q, p + 1):
		l2.append(2 ** i)
	for i in range(1, q):
		l1.append(2 ** i)
	print(sum(l1) - sum(l2))
	return
t = int(input())
for i in range(t):
	n = int(input())
	pab(n)


t = input()
for y in range(int(t)):
	n = int(input())
	print(2 * (2 ** (n // 2) - 1))


for _ in range(int(input())):
	n = int(input())
	m = n // 2
	ans = 0
	for i in range(m - 1):
		ans += 2 ** (i + 1)
	ans += 2 ** n
	ans1 = 0
	for i in range(m, n):
		ans1 += 2 ** i
	print(abs(ans - ans1))


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = 2 ** n
	tmp = n // 2
	for i in range(1, tmp):
		a += 2 ** i
	b = 0
	for i in range(tmp, n):
		b += 2 ** i
	print(a - b)


t = int(input())
for _ in range(t):
	n = int(input())
	i = 1
	diff = 0
	while i <= n:
		if i < n // 2 or i == n:
			diff += 2 ** i
		else:
			diff -= 2 ** i
		i += 1
	print(diff)


test = int(input())
t_arr = []
for _ in range(test):
	n = int(input())
	arr_ = []
	a = 0
	b = 0
	for i in range(1, n + 1):
		arr_.append(pow(2, i))
	a += arr_[-1]
	arr_.pop()
	for j in range(0, int(n / 2)):
		b += arr_[-1]
		arr_.pop()
	for j in arr_:
		a += j
	t_arr.append(abs(a - b))
for t in t_arr:
	print(t)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x
for t in range(int(input())):
	n = int(input())
	pile1 = 2 ** n
	pile2 = 0
	for i in range(1, n):
		if i < n // 2:
			pile1 += 2 ** i
		else:
			pile2 += 2 ** i
	print(abs(pile1 - pile2))


t = int(input())
for _ in range(t):
	n = int(input())
	sum1 = 2 * (2 ** (n // 2 - 1) - 1) + 2 ** n
	sum2 = 2 * (2 ** n - 1) - sum1
	diff = abs(sum1 - sum2)
	print(diff)


def inpint():
	return int(input())

def inpilist():
	return list(map(int, input().split()))

def inpimap():
	return map(int, input().split())

def inplist():
	return input().split()

def inpstr():
	return list(input())

def main():
	t = inpint()
	for _ in range(t):
		n = inpint()
		a = 2 ** n + 2 ** (n // 2) - 2
		tot = 2 ** (n + 1) - 2
		ans = 2 * a - tot
		print(ans)
main()


t = int(input())

def abs(a, b):
	if a >= b:
		return a - b
	if a < b:
		return b - a
for _ in range(0, t):
	n = int(input())
	base = [1]
	sum = 0
	res = 9999999999999
	for i in range(1, n + 1):
		base.append(base[i - 1] * 2)
		sum += base[i]
	for i in range(1, n - n // 2 + 2):
		a = 0
		for j in range(i, i + n // 2):
			a += base[j]
		res = min(res, abs(a, sum - a))
	print(res)


dp = [0] * 34
dp[2] = 2
for i in range(4, 32, 2):
	dp[i] = 2 * dp[i - 2] + 2
for T in range(int(input())):
	n = int(input())
	print(dp[n])


t = int(input())
for i in range(t):
	n = int(input())
	a = 0
	b = 0
	al = n // 2
	bl = n // 2
	for i in range(n, 0, -1):
		if a >= b and bl:
			b += 2 ** i
			bl -= 1
		elif al:
			a += 2 ** i
			al -= 1
		else:
			b += 2 ** i
			bl -= 1
	print(abs(a - b))


test = int(input())
for t in range(test):
	numofcoins = int(input())
	lsst = [0 for i in range(numofcoins)]
	for i in range(numofcoins):
		lsst[i] = 2 ** (i + 1)
	mid = numofcoins / 2
	mid -= 1
	large = lsst[numofcoins - 1]
	small = 0
	for i in range(numofcoins - 1):
		if i < mid:
			large += lsst[i]
		else:
			small += lsst[i]
	print(large - small)


t = int(input())
li = [2 ** i for i in range(1, 31)]
for _ in range(t):
	n = int(input())
	ar = li[:n]
	su = sum(ar)
	s = ar[-1] + sum(ar[:n // 2 - 1])
	print(abs(su - 2 * s))


import sys

def main():
	queries = map(int, sys.stdin.readlines()[1:])
	lookup = [2, 6, 14, 30, 62, 126, 254, 510, 1022, 2046, 4094, 8190, 16382, 32766, 65534]
	output = [lookup[q // 2 - 1] for q in queries]
	print(*output, sep='\n')
BUFSIZE = 8192

def print_int_lines(lst):
	print('\n'.join(map(str, lst)))
main()


for _ in range(int(input())):
	n = int(input())
	(sum1, sum2) = (0, 0)
	lis = [pow(2, x) for x in range(1, n + 1)]
	sum1 = lis[-1]
	for i in range(0, n // 2 - 1):
		sum1 += lis[i]
	for i in range(n // 2 - 1, n - 1):
		sum2 += lis[i]
	print(abs(sum1 - sum2))


i = 0
t = int(input())
while i < t:
	n = int(input())
	l = list(map(int, map(lambda x: 2 ** x, range(1, n + 1))))
	ln = len(l)
	a = []
	b = []
	for j in range(0, int(n)):
		if j < n / 2 or j == n:
			a.append(l[j - 1])
		else:
			b.append(l[j - 1])
	print(sum(a) - sum(b))
	i = i + 1


def solve(n):
	max_val = 2 ** n
	large_sum = 2 ** n
	initial = 2
	for i in range(n // 2 - 1):
		large_sum += initial
		initial *= 2
	small_sum = max_val - initial
	return large_sum - small_sum
t = int(input())
for num in range(1, t + 1):
	n = int(input())
	answer = solve(n)
	print(answer)


num = int(input())
for _ in range(num):
	n = int(input())
	coins = [2 ** i for i in range(1, n + 1)]
	a = 0
	b = 0
	counter = 0
	j = 0
	for i in range(n):
		a += coins[i] + coins[n - 1 - i]
		counter += 1
		j = i
		if counter == n / 2:
			counter = 0
			break
	for i in range(j + 1, n):
		b += coins[i]
		if counter == n / 2:
			break
	print(abs(b - a))


q = int(input())
for _ in range(q):
	n = int(input())
	print(2 * (pow(2, n // 2) - 1))


def solve(n):
	seg = 2 ** (n // 2) - 2
	return abs(2 ** n + seg - (2 ** (n + 1) - 2 ** n - 2 - seg))
t = int(input())
for i in range(t):
	print(solve(int(input())))


import sys
sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline

def solve():
	t = int(rl())
	pow_of_2 = [0]
	for exp in range(1, 31):
		pow_of_2.append(2 ** exp)
	ans = []
	for _ in range(t):
		n = int(rl())
		sm = pow_of_2[n]
		for i in range(1, n // 2):
			sm += pow_of_2[i]
		for i in range(n // 2, n):
			sm -= pow_of_2[i]
		ans.append(sm)
	print(*ans, sep='\n')
solve()


t = int(input())
while t > 0:
	N = int(input())
	ws = [2 ** x for x in range(1, N + 1)]
	lb = [2 ** x for x in range(N // 2, N)]
	print(abs(sum(lb) - sum([x for x in ws if not x in lb])))
	t -= 1


tc = int(input())
for _ in range(tc):
	num = int(input())
	set1 = []
	set2 = []
	set1.append(pow(2, num))
	half = num // 2
	num -= 1
	while num != half - 1:
		set2.append(pow(2, num))
		num -= 1
	while num != 0:
		set1.append(pow(2, num))
		num -= 1
	print(abs(sum(set1) - sum(set2)))


from math import ceil
from math import floor

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def find_least_diff(n):
	A = 2 * (pow(2, n / 2 - 1) - 1)
	B = -pow(2, n / 2)
	return int(abs(B - A))
t = 1
t = int(input())
while t:
	t = t - 1
	count = 0
	px = []
	py = []
	n = int(input())
	print(find_least_diff(n))


vals = [-1]

def computevals():
	global vals
	for i in range(1, 31):
		vals.append(pow(2, i))
computevals()
for t in range(int(input())):
	asumm = 0
	bsumm = 0
	N = int(input())
	asumm += vals[N]
	for i in range(1, N // 2):
		asumm += vals[i]
	for i in range(N // 2, N):
		bsumm += vals[i]
	print(abs(asumm - bsumm))


cases = int(input())
for i in range(cases):
	n = int(input())
	test = [2 ** i for i in range(1, n + 1)]
	a = []
	b = []
	while test:
		if sum(a) > sum(b):
			if len(b) == n / 2:
				a.append(test.pop())
			else:
				b.append(test.pop())
		elif sum(b) > sum(a):
			if len(a) == n / 2:
				b.append(test.pop())
			else:
				a.append(test.pop())
		else:
			a.append(test.pop())
	print(abs(sum(a) - sum(b)))


l1 = [2]
for i in range(14):
	l1.append(l1[-1] * 2 + 2)
for _ in range(int(input())):
	n = int(input())
	print(l1[n // 2 - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	l = []
	s = 0
	e = 0
	for i in range(1, n + 1):
		l.append(2 ** i)
	for j in range(0, n):
		if j < n // 2 - 1:
			s = s + l[j]
		else:
			e = e + l[j]
	a = e - l[-1]
	print(s + l[-1] - a)


test_cases = int(input())
for j in range(test_cases):
	big_brain_arr = [2 ** n for n in range(1, int(input()))]
	big_brain_arr.reverse()
	array1 = []
	array2 = []
	for element in big_brain_arr:
		if sum(array1) <= sum(array2):
			if len(array1) != len(big_brain_arr) // 2:
				array1.append(element)
			else:
				array2.append(element)
		elif len(array2) != len(big_brain_arr) // 2:
			array2.append(element)
		else:
			array1.append(element)
	print(abs(sum(array1) - sum(array2)))


number = int(input())
for i in range(number):
	n = int(input())
	pile1 = 2 ** n
	pile2 = 2 ** int(n / 2)
	for i in range(int(n / 2) - 1):
		pile1 += 2 ** (i + 1)
		pile2 += 2 ** (int(n / 2) + i + 1)
	print(pile1 - pile2)


for _ in range(int(input())):
	n = int(input())
	coin = [2 ** i for i in range(1, n + 1)]
	print(abs(coin[n - 1] + sum(coin[:n // 2 - 1]) - sum(coin[n // 2 - 1:n - 1])))


t = int(input())
num = 1
arr = []
for i in range(30):
	val = 2 * num
	arr.append(val)
	num = val
for i in range(t):
	n = int(input())
	s1 = arr[n - 1]
	s2 = 0
	for j in range(n - int(n / 2) - 1):
		s1 += arr[j]
	for j in range(n - int(n / 2) - 1, n - 1):
		s2 += arr[j]
	print(abs(s1 - s2))


from collections import deque
for _ in range(int(input())):
	n = int(input())
	first = 2 ** n
	second = 0
	for i in range(n - 1, n - 1 - n // 2, -1):
		second += 2 ** i
	for i in range(n - 1 - n // 2, 0, -1):
		first += 2 ** i
	print(first - second)


for _ in range(int(input())):
	n = int(input())
	arr = [2 ** i for i in range(1, n + 1)]
	(left, right) = ([], [])
	arr.sort(reverse=True)
	for i in arr:
		if len(left) == 0:
			left.append(i)
		elif len(right) == 0:
			right.append(i)
		elif abs(sum(left) + i - sum(right)) < abs(sum(right) + i - sum(left)) or len(right) == n // 2:
			left.append(i)
		else:
			right.append(i)
	print(abs(sum(left) - sum(right)))


test = int(input())
while test > 0:
	num1 = int(input())
	i1 = 1
	i2 = 1
	s1 = 0
	s2 = 0
	while i1 < num1 / 2:
		s1 += 2 ** i1
		i1 += 1
	s1 += 2 ** num1
	i1 = num1 / 2
	while i1 < num1:
		s2 += 2 ** i1
		i1 += 1
	print(int(s1 - s2))
	test -= 1


def main():
	t = int(input())
	for _ in range(1, t + 1):
		n = int(input())
		p1 = sum((2 ** i for i in range(1, n // 2))) + 2 ** n
		p2 = sum((2 ** i for i in range(n // 2, n)))
		print(int(p1 - p2))
main()


t = int(input())
while t > 0:
	n = int(input())
	(sum_l, sum_r) = (2 ** n, 0)
	for i in range(1, n // 2):
		sum_l += 2 ** i
	for i in range(n // 2, n):
		sum_r += 2 ** i
	print(sum_l - sum_r)
	t -= 1


from math import ceil
t = int(input())
for _ in range(t):
	n = int(input())
	coins = [2 ** x for x in range(1, n + 1)]
	half = n // 2
	left = coins[-1] + sum(coins[:half - 1])
	print(abs(sum(coins) - left - left))


for _ in range(int(input())):
	n = int(input())
	re = 2 ** n
	for i in range(1, n // 2):
		re += 2 ** i
	for i in range(n // 2, n):
		re -= 2 ** i
	print(re)


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	for i in range(1, n + 1):
		l.append(pow(2, i))
	a = 0
	b = 0
	i = 0
	r = len(l)
	j = r // 2
	c = 0
	while len(l) != 0:
		a = a + max(l)
		l.pop(-1)
		c = 1
		for k in range(j - 1):
			a = a + min(l)
			l.pop(0)
		b = sum(l)
		break
	print(abs(a - b))


n = int(input())
p = [2 ** (i + 1) for i in range(30)]
for i in range(n):
	cur = int(input())
	left = p[cur - 1]
	right = 0
	for j in range(cur - 1):
		if j < cur // 2 - 1:
			left += p[j]
		else:
			right += p[j]
	print(abs(left - right))


t = int(input())
for _ in range(t):
	n = int(input())
	li = [2 ** i for i in range(1, n + 1)]
	tmp = li[-1]
	for i in range(n // 2 - 1):
		tmp += li[i]
	tmp1 = sum(li) - tmp
	print(abs(tmp1 - tmp))


import math
import sys
input = sys.stdin.readline
output = sys.stdout

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solve(n):
	l = []
	for i in range(1, n + 1):
		l.append(int(math.pow(2, i)))
	num1 = l[n - 1] + sum(l[:n // 2 - 1])
	num2 = sum(l[n // 2 - 1:n - 1])
	output.write(str(num1 - num2) + '\n')
n = inp()
for i in range(n):
	num = inp()
	solve(num)


arr = []
for i in range(0, 31):
	arr.append(pow(2, i))
for _ in range(int(input())):
	(a, b) = (0, 0)
	n = int(input())
	for i in range(1, n // 2):
		a += arr[i]
	a += arr[n]
	for i in range(1, n + 1):
		b += arr[i]
	b = b - a
	print(abs(b - a))


from sys import stdin

def list_int():
	s = stdin.readline()[:-1]
	return list(map(int, s.split()))

def list_float():
	s = stdin.readline()[:-1]
	return list(map(float, s.split()))

def list_str():
	s = stdin.readline()[:-1]
	return list(s.split())

def space_int():
	s = stdin.readline()[:-1]
	return map(int, s.split())

def space_float():
	s = stdin.readline()[:-1]
	return map(float, s.split())

def space_str():
	s = stdin.readline()[:-1]
	return s.split()

def _int():
	s = stdin.readline()[:-1]
	return int(s)

def _str():
	s = stdin.readline()[:-1]
	return s

def _float():
	s = stdin.readline()[:-1]
	return float(s)

def _gcd(a, b):
	if a == 0:
		return b
	return _gcd(b % a, a)

def _sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	return prime
alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
maxi = -2 ** 32
mini = 2 ** 32
mod = 10 ** 9 + 7
l = []
for i in range(1, 31):
	l.append(2 ** i)
for _ in range(_int()):
	n = _int()
	p = l[:n]
	a1 = p[-1]
	a2 = 0
	c = 1
	for i in range(n - 1):
		if c == n // 2:
			a2 += p[i]
		else:
			a1 += p[i]
			c += 1
	print(abs(a1 - a2))


for _ in range(int(input())):
	n = int(input())
	l = 0
	r = 0
	a = n // 2
	if n == 2:
		print(2)
	else:
		for x in range(1, n + 1):
			if x < a or x == n:
				l += 2 ** x
			else:
				r += 2 ** x
		print(l - r)


n = int(input())
ml = []
for i in range(n):
	i = int(input())
	l = []
	for r in range(i):
		l += [2 ** (r + 1)]
	ml += [l]
for q in ml:
	if len(q) == 2:
		print('2')
	else:
		a = 0
		b = 0
		for w in range(int(len(q) / 2) - 1):
			a += q[w]
		a += q[-1]
		for r in range(int(len(q) / 2) - 1, len(q) - 1):
			b += q[r]
		print(a - b)


def solveWeights(n):
	a = 0
	b = pow(2, n)
	for i in range(n - 1, n // 2 - 1, -1):
		a += pow(2, i)
	for i in range(1, n // 2):
		b += pow(2, i)
	print(abs(a - b))
t = int(input())
for i in range(t):
	n = int(input())
	solveWeights(n)


T = int(input())
for t in range(T):
	n = int(input())
	first = [1] * n
	first[0] = 2
	for i in range(1, n):
		first[i] = 2 * first[i - 1]
	ans = first[n - 1]
	for i in range(n // 2 - 1):
		ans += first[i]
	for i in range(n // 2 - 1, n - 1):
		ans -= first[i]
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	vetor = []
	for a in range(1, n + 1):
		vetor.append(2 ** a)
	print(vetor[int(n / 2)] - 2)


tc = int(input())
for i in range(tc):
	n = int(input())
	(suma, cnt) = (2 ** n, 1)
	x = [i for i in range(1, n)]
	while cnt <= n // 2:
		suma -= 2 ** x[-1]
		x.pop(-1)
		if len(x) == 0:
			break
		suma += 2 ** x[0]
		x.pop(0)
		cnt += 1
	print(suma)


def calc(n):
	if n == 2:
		return 2
	return calc(n - 2) * 2 + 2
for _ in range(int(input())):
	n = int(input())
	print(calc(n))


import math
import os
import random
import re
import sys
t = int(input())
ansArr = []
for i in range(t):
	n = int(input())
	ans = math.pow(2, n)
	p = n
	p1 = 1
	while True:
		if p1 <= n / 2 - 1:
			ans = ans - math.pow(2, p - 1) + math.pow(2, p1)
			p1 += 1
		else:
			ans = ans - math.pow(2, p - 1)
		p -= 1
		if p == n / 2:
			break
	ansArr.append(int(ans))
for value in ansArr:
	print(value)


t = int(input())
base = 2
k = []
b = []
z = []
y = []
e = []
n = 0
while n < t:
	x = int(input())
	n += 1
	k.append(x)
for i in k:
	if i == 2:
		e.append(2)
	else:
		h = 0
		exp = 1
		while h < i:
			c = pow(base, exp)
			b.append(c)
			exp += 1
			h += 1
		for j in range(len(b)):
			c = len(b) / 2 - 1
			c = int(c)
			u = len(b) - 1
			u = int(u)
			if j < c or j == u:
				z.append(b[j])
			else:
				y.append(b[j])
		d = sum(z)
		f = sum(y)
		k = abs(d - f)
		b = []
		e.append(k)
		z = []
		y = []
for i in e:
	print(i)


n = int(input())
for i in range(n):
	a = int(input())
	b = a // 2
	c = pow(2, a + 1) - 2 - (pow(2, a) + pow(2, b) - 2)
	print(pow(2, a) + pow(2, b) - 2 - c)


for _ in range(int(input())):
	n = int(input())
	if n == 4:
		print(6)
	elif n == 2:
		print(2)
	else:
		temp = 2 * (2 ** (n / 2 - 1) - 1) + 2 ** n
		temp2 = 2 * (2 ** n - 1) - temp
		print(int(max(temp, temp2) - min(temp, temp2)))


t = int(input())
for i in range(t):
	n = int(input())
	a = 0
	b = 0
	count_a = 0
	count_b = 0
	for i in range(n, 0, -1):
		if a <= b and count_a + 1 <= n // 2:
			a += pow(2, i)
			count_a += 1
		elif count_b + 1 <= n // 2:
			b += pow(2, i)
			count_b += 1
		else:
			a += pow(2, i)
			count_a += 1
	print(abs(a - b))


t = input()
ans = []
for i in range(int(t)):
	n = int(input())
	half = int(n / 2)
	sum_a = sum([2 ** i for i in range(1, half)]) + 2 ** n
	sum_b = sum([2 ** i for i in range(half, n)])
	ans.append(abs(sum_a - sum_b))
for i in ans:
	print(i)


from sys import stdin, stdout
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = n // 2
	s1 = 2 * (2 ** (a - 1) - 1) + 2 ** n
	s2 = 2 ** a * (2 ** a - 1)
	print(abs(s1 - s2))


t = int(input())
l = []
for i in range(1, 31):
	l.append(pow(2, i))
for j in range(t):
	x = int(input())
	y = l[0:x]
	temp = 0
	for k in range(x - 2, x // 2 - 2, -1):
		temp = temp + y[k]
	print(sum(y) - 2 * temp)


from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	sum1 = 0
	sum2 = 0
	for i in range(1, n // 2):
		sum1 += 2 ** i
	sum1 += 2 ** n
	for i in range(n // 2, n):
		sum2 += 2 ** i
	print(abs(sum2 - sum1))


for something in range(int(input())):
	n = int(input())
	print(2 + (2 ** (n // 2) - 2) * 2)


def solve():
	n = int(input())
	q = 0
	for i in range(n // 2 - 1):
		q += 2 ** (i + 1)
	for i in range(n // 2 - 1, n - 1):
		q -= 2 ** (i + 1)
	q += 2 ** n
	return q
t = int(input())
ans = []
while t:
	ans.append(str(solve()))
	t -= 1
print('\n'.join(ans))


tc = int(input())
for i in range(tc):
	x = int(input())
	count = 0
	for i in range(1, x // 2 + 1):
		count += 2 ** i
	print(count)


t = int(input())
n2 = [2]
i = 2
while i <= 30:
	n2.append(n2[-1] * 2)
	i += 1
for i in range(t):
	n = int(input())
	if n == 2:
		print(2)
		continue
	res = n2[n - 1]
	print(n2[n - 1] + sum(n2[:n // 2 - 1]) - sum(n2[n // 2 - 1:n - 1]))


from sys import stdin

def func():
	return
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	k = n // 2
	ans = 2 ** n
	for i in range(k - 1):
		ans += 2 ** (i + 1)
	a = 0
	for i in range(k - 1, n - 1):
		a += 2 ** (i + 1)
	print(ans - a)


from collections import deque
from collections import OrderedDict
import math
import sys
import os
from io import BytesIO
for t in range(int(input())):
	n = int(input())
	sumAnswer = 2 ** n
	sumAnswer -= 2 ** (n - 1)
	minus = n - 2
	plus = 1
	while minus > plus:
		sumAnswer += 2 ** plus
		sumAnswer -= 2 ** minus
		plus += 1
		minus -= 1
	print(sumAnswer)


w = int(input())
a = []
for i in range(0, w):
	p = int(input())
	a.append(p)
for i in range(0, w):
	s = 0
	for j in range(1, int(1 + int(a[i]) / 2)):
		s = s + 2 ** j
	print(int(s))


count = int(input())
for _ in range(count):
	coins = int(input())
	print(2 ** (coins // 2 + 1) - 2)


t = int(input())
for _ in range(t):
	q = int(input())
	li = [2 ** i for i in range(1, q + 1)]
	mid = q // 2 - 1
	f_h = sum(li[0:mid]) + li[-1]
	l_h = sum(li[mid:q - 1])
	print(abs(f_h - l_h))


def solve(n):
	sum_p = 0
	sum_m = 0
	if n == 2:
		print(2)
	else:
		a = [2 ** i for i in range(1, n + 1)]
		for i in range(max(1, int(n / 2) - 1)):
			sum_p += a[i]
		sum_p += a[-1]
		for i in range(int(n / 2) - 1, n - 1):
			sum_m += a[i]
		print(abs(sum_m - sum_p))
t = int(input())
for i in range(t):
	n = int(input())
	solve(n)


def balance(n):
	if n == 2:
		return 2
	else:
		a = 2 ** n
		b = 0
		m = n // 2
		for i in range(1, m):
			a += 2 ** i
		for j in range(m, n):
			b += 2 ** j
		return abs(a - b)
for _ in range(int(input())):
	n = int(input())
	print(balance(n))


def PhoenixandBalance(n):
	suma_a = 2 ** n
	suma_b = 0
	for i in range(n - 1):
		if i + 1 < n / 2:
			suma_a += 2 ** (i + 1)
		else:
			suma_b += 2 ** (i + 1)
	return abs(suma_a - suma_b)
Lista = []
total = int(input())
for i in range(total):
	Lista.append(int(input()))
for j in Lista:
	print(PhoenixandBalance(j))


t = int(input())
for T in range(t):
	n = int(input())
	sum1 = 2 ** n
	sum2 = 2 ** (n - 1)
	for i in range((n - 2) // 2):
		if sum1 >= sum2:
			sum1 += 2 ** (i + 1)
			sum2 += 2 ** (n - 2 - i)
	print(abs(sum1 - sum2))


t = int(input())
for _ in range(t):
	n = int(input())
	i = 1
	sum1 = 0
	sum2 = 0
	if n == 2:
		print(2)
	elif n == 4:
		print(6)
	else:
		while i <= n // 2 - 1:
			sum1 += 2 ** i
			i += 1
		while i <= n - 1:
			sum2 += 2 ** i
			i += 1
		sum1 += 2 ** n
		print(abs(sum1 - sum2))


for i in range(int(input())):
	n = int(input())
	one = 2 ** n
	two = 0
	for i in range(1, n // 2):
		one += 2 ** i
	for i in range(n // 2, n):
		two += 2 ** i
	print(abs(one - two))


from sys import stdin

def r():
	return stdin.readline()

def r_t():
	return map(int, r().strip().split())

def r_a():
	return list(r_t())

def solve(n):
	(A, i, B) = (2 ** n, 0, 0)
	while i < n // 2 - 1:
		A += 2 ** (i + 1)
		i += 1
	while i < n - 1:
		B += 2 ** (i + 1)
		i += 1
	return abs(A - B)

def main():
	cases = int(r())
	for case in range(cases):
		n = int(r())
		print(solve(n))
main()


def minDiff(n):
	l = 0
	r = 0
	for i in range(1, n):
		if i < n // 2:
			l += 2 ** i
		else:
			r += 2 ** i
	return abs(l + 2 ** n - r)
for _ in range(int(input())):
	print(minDiff(int(input())))


t = int(input())
nlist = []
for i in range(t):
	n = int(input())
	nlist.append(n)
for n in nlist:
	alist = []
	blist = []
	alist.append(2 ** n)
	for ii in range(1, int(n / 2)):
		alist.append(2 ** ii)
	for iii in range(int(n / 2), n):
		blist.append(2 ** iii)
	asum = 0
	bsum = 0
	for ae in alist:
		asum = asum + ae
	for be in blist:
		bsum = bsum + be
	print(asum - bsum)


t = int(input())
for testcase in range(t):
	n = int(input())
	arr = list()
	for i in range(n):
		arr.append(2 ** (i + 1))
	if len(arr) == 2:
		print(arr[1] - arr[0])
		continue
	i = 0
	j = n - 3
	arr1 = list()
	arr2 = list()
	large = arr[n - 1]
	small = arr[n - 2]
	while i < j:
		arr1.append(arr[i])
		large += arr[i]
		arr2.append(arr[j])
		small += arr[j]
		i += 1
		j -= 1
	print(abs(large - small))


T = int(input())
n = [0] * T
for t in range(T):
	n[t] = int(input())
for i in n:
	if i == 2:
		print('2')
	else:
		print(int((2 ** i - 2 ** int(0.5 * i)) * 2 ** (-int(i * 0.5 - 1))))


c = int(input())
while c > 0:
	n = int(input())
	x = n / 2
	b = 2 ** n
	a = 2 ** (n / 2)
	while x > 1:
		b = b + 2 ** (x - 1)
		a = a + 2 ** (-x + n + 1)
		x -= 1
	c -= 1
	print(int(abs(a - b)))


import math
for i in range(int(input())):
	l = [2]
	n = int(input())
	for i in range(n - 1):
		l.append(l[-1] * 2)
	if n == 2:
		print(2)
	else:
		x = sum(l[:n // 2 - 1]) + l[-1]
		print(abs(sum(l) - 2 * x))


t = int(input())
res = []
for _ in range(t):
	n = int(input())
	mn = 2 ** n + sum([2 ** i for i in range(1, n // 2)]) - sum([2 ** i for i in range(n // 2, n)])
	res.append(mn)
for r in res:
	print(r)


from collections import defaultdict, Counter
from functools import lru_cache
from heapq import heappush, heappop
from math import gcd, floor, ceil
from sys import stdin, stdout

def ilist():
	return [int(x) for x in stdin.readline().strip().split(' ')]

def iint():
	return int(stdin.readline().strip())

def istr():
	return stdin.readline().strip()

def solve(n):
	coins = [2 ** i for i in range(1, n + 1)]
	k = n // 2
	res = float('inf')
	for i in range(k - 1, n):
		a = sum(coins[i - k + 1:i + 1])
		b = sum(coins) - a
		res = min(res, abs(a - b))
	return res
t = iint()
for _ in range(t):
	n = iint()
	print(solve(n))


import sys

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	a_sum = 0
	b_sum = 0
	a_sum += pow(2, n)
	for i in range(1, n // 2):
		a_sum += pow(2, i)
	for i in range(n // 2, n):
		b_sum += pow(2, i)
	print(int(abs(a_sum - b_sum)))


t = int(input())
for k in range(t):
	n = int(input())
	if n == 2:
		print(2)
	else:
		a = 2 + 2 ** n
		b = 0
		for i in range(2, n // 2):
			a = a + 2 ** i
		for j in range(n // 2, n):
			b = b + 2 ** j
		print(abs(a - b))


t = int(input())
while t > 0:
	n = int(input())
	ls = 0
	rs = 0
	diff = 0
	for i in range(1, n + 1):
		if i == n or i < n // 2:
			ls += 2 ** i
		else:
			rs += 2 ** i
	print(abs(ls - rs))
	t -= 1


for _ in range(int(input())):
	(w, s, r) = ([], 0, 0)
	n = int(input())
	for i in range(1, n + 1):
		w.append(pow(2, i))
	s = w[-1]
	for i in range(n // 2 - 1):
		s += w[i]
	for i in range(n // 2 - 1, n - 1):
		r += w[i]
	print(s - r)


a = int(input())

def jumper(num):
	summ = 2
	degree = num // 2
	for i in range(2, degree + 1):
		summ += 2 ** i
	return summ
arr = []
for i in range(a):
	num = int(input())
	arr.append(num)
for a in arr:
	print(jumper(a))


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = pow(2, n)
	for x in range(1, n // 2):
		a += pow(2, x)
	print(a - pow(2, n + 1) + 2 + a)


for i in range(int(input())):
	n = int(input())
	s = 2 * (2 ** n - 1)
	p = 2 * (2 ** (n // 2 - 1) - 1)
	k = int(2 ** n)
	j = s - p - k
	print(abs(j - (p + k)))


for i in range(int(input())):
	coins = int(input())
	diff = 0
	for j in range(coins // 2):
		diff += pow(2, j + 1)
	print(diff)


T = int(input())
for _ in range(T):
	N = int(input())
	selected = 0
	count = 0
	for i in range(N, 0, -1):
		if selected <= 0 and count < N // 2 or i == N // 2 - count:
			selected += 2 ** i
			count += 1
		else:
			selected -= 2 ** i
	print(selected)


_IS_DEBUG_MODE = False

def Problem():
	if _IS_DEBUG_MODE == True:
		testcaseList = []
		testcaseList.append(2)
		testcaseList.append(4)
		testcaseList.append(6)
	else:
		t = int(input())
		testcaseList = []
		for testcaseIndex in range(t):
			n = int(input())
			testcaseList.append(n)
	return testcaseList

def Solver(testcaseList):
	for n in testcaseList:
		if _IS_DEBUG_MODE == True:
			print('testcase', n)
		if _IS_DEBUG_MODE == True:
			print('a =')
		a = 0
		for i in range(1, int(n / 2)):
			a += 2 ** i
			if _IS_DEBUG_MODE == True:
				print(i, 2 ** i)
		a += 2 ** n
		if _IS_DEBUG_MODE == True:
			print('b =')
		b = 0
		for i in range(int(n / 2), n):
			b += 2 ** i
			if _IS_DEBUG_MODE == True:
				print(i, 2 ** i)
		m = abs(a - b)
		print(m)
if _IS_DEBUG_MODE == True:
	import time
	startTime = time.time()
testcaseList = Problem()
Solver(testcaseList)
if _IS_DEBUG_MODE == True:
	endTime = time.time()
	print('time', endTime - startTime)


t = int(input())
for i in range(t):
	n = int(input())
	n_l = n // 2
	tmp_1 = 0
	tmp_2 = 0
	for j in range(1, n):
		if j < n_l:
			tmp_1 += 2 ** j
		else:
			tmp_2 += 2 ** j
	tmp_1 += 2 ** n
	print(abs(tmp_1 - tmp_2))


import math
for w in range(int(input())):
	soma1 = 0
	soma2 = 0
	n = int(input())
	for i in range(n):
		if i >= n / 2 - 1 and i != n - 1:
			soma2 += 2 ** (i + 1)
		else:
			soma1 += 2 ** (i + 1)
	print(abs(soma1 - soma2))


arr = []
for i in range(1, 31):
	arr.append(2 ** i)

def calculate():
	n = int(input())
	a = arr[:n]
	x = 0
	x += a[-1]
	x += sum(a[:n // 2 - 1])
	print(abs(x - sum(a[n // 2 - 1:-1])))
tt = int(input())
for _ in range(tt):
	calculate()


v = int(input())
while v != 0:
	value = 0
	n1 = int(input())
	value = 2 ** n1
	for _ in range(int(n1 / 2) - 1):
		value /= 2
	value -= 2
	print(int(value))
	v = v - 1


from sys import stdin, stdout
pows = [1 << i for i in range(31)]
test = int(stdin.readline())
for _ in range(test):
	N = int(stdin.readline())
	grp1 = pows[N]
	for i in range(1, N // 2):
		grp1 += pows[i]
	grp2 = sum(pows[N // 2:N])
	print(grp1 - grp2)


for _ in range(int(input())):
	n = int(input())
	c = n // 2
	count = 0
	lol = 0
	for i in range(1, n + 1):
		count += 2 ** i
	k = count
	for i in range(1, c):
		lol += 2 ** i
	lol = lol + 2 ** n
	kk = count - lol
	print(abs(kk - lol))