What a good approach will be to solve this problem? 
*

*I know that this function from A to A is 1-1 and also onto.


How many functions like this exists ?
The set A contain 12 elements.
$$\forall a \in A $$
$$f(f(a)) \ne a{\rm{  ,    }}$$
$$f(f(f(a))) = a{\rm{       }}$$
I dont know how to start solving this problem.
Should I use inclusion and exclusion to solve this ?
 A: You want to count certain permutations of a finite set $A$ with $n$ elements.
This problem boils down to learning about cycle notation of permutations.
What you want is permutations that consist of three-cycles and no fixed points.
So we can immediately see no such functions exist if $n$ is not a multiple of $3$.
If $n$ is a multiple of $3$ there are $\frac{n!}{(n/3)!3^{n/3}}$ such permutations.
Why?
The permutation will look like this:
$(***)(***)(***)\dots (***)$
we have to select how to fill in the asterisks. There are $n!$ ways to do so, however the order in which the cycles appear is irrelevant, also notice that every $3$-cycle can be rotated internally in three ways and yields the same permutation. (For example, $(1,2,3)$ and $(2,3,1)$ and $(3,1,2)$ are the same permutation). Therefore the $n!$ possible arrangements fit into groups of size $(\frac{n}{3})!3^{n/3}$ that all yield the same permutation.
Final answer:
$$\frac{n!}{(n/3)!3^{n/3}}$$ 
if $n$ is a multiple of $3$ and zero otherwise.
A: Hint: Any invertible $f:A \to A$ corresponds a permutation of the elements.
That permutation may be decomposed into cycles.  Note that $f$ is a satisfactory map if and only if all of the cycles in the resulting decomposition have length $3$.
A: Hint
The existence will depend on the size of $A$. For example if $|A|=1 \text{ or } 2$, then no such function can exist (because by the first condition the identity function is already ruled out). For $3 \leq |A| < \infty$. We can do the counting as follows. Let $A=\{1,2,3, \ldots, n\}$. Then any bijective function from $A$ to itself can be represented as a product of disjoint cycles. So the problem reduces to finding all elements which can be represented as cycles of length $3$ (and no fixed elements) in $S_n$. If you are not familiar with symmetric group $S_n$ then let me know and I will modify my hint accordingly.
A: I don't know how to answer the question "how many such functions exist", but it appears that at least one such function exists:
For suitable A, let $$f(x)=\frac{x-1}{x}$$ 
Then, $$ff(x)=\frac{1}{1-x}$$
And so $$fff(x)=x$$
