def sort_tuple(tup):
	 
	lst = len(tup) 
	for i in range(0, lst): 
		for j in range(0, lst-i-1): 
			if (tup[j][-1] > tup[j + 1][-1]): 
				temp = tup[j] 
				tup[j]= tup[j + 1] 
				tup[j + 1]= temp 
	return tup
def count_ways(n):
	 
	A = [0] * (n + 1) 
	B = [0] * (n + 1) 
	A[0] = 1
	A[1] = 0
	B[0] = 0
	B[1] = 1
	for i in range(2, n+1): 
		A[i] = A[i - 2] + 2 * B[i - 1] 
		B[i] = A[i - 1] + B[i - 2] 
	return A[n] 