# How many one to one correspondences are there from $A=\{A_1,A_2,A_3,A_4,A_5\}$ to $B=\{B_1,B_2,B_3,B_4,B_5\}$ such that…

I got this problem:

Let $A=\{A_1,A_2,A_3,A_4,A_5\}$ and $B=\{B_1,B_2,B_3,B_4,B_5\}$ be two sets.
How many one to one correspondences (one to one and onto functions) from $A$ to $B$ are there that satisfy the condition:

$\exists i\in\{1,2,3,4,5\}$ such that $f(A_i)=B_i$

Can you generalize the result when $A$ and $B$ have $n$ elements?

I am stuck on this problem for at least $2\frac{1}{2}$ hours.

Thanks any hint/help.