Let \( \mathbb{N} \) denote the set of all positive integers. Consider the sets \( A = \{ 1, 2, 3, 4, 5 \} \) and \( B = \{ 1, 2, 3, 4, 5, 6, 7 \} \).
Let \( S \) be the set of all functions \( f : A \to B \) such that \( f(2) \neq 2 \) and \( f(4) \neq 4 \). Consider the set \( T = \{ f \in S : \text{ there exists a function } g : B \to \mathbb{N} \text{ such that } g(f(x)) = 2^x \text{ for all } x \in A \} \).
Then the number of elements in the set \( T \) is ________.