Expected value that list index equals its value. Setup
Suppose I have a shuffled list of elements from 1 to 10. One such array is [7 2 6 1 10 4 9 3 5 8]. What is the expected number of elements i that is equal to the value in that array?
In the given example, the absolute value is 1:
 [7  2  6  1 10 4  9  3  5 8 ]
 [1  2  3  4 5  6  7  8  9 10]
 [   ^                       ]

value = 1

Simulation
I wrote the following python program:
from random import shuffle

numbers = [i for i in range(0, 100)]

c = 0
a = 0
while True:
  shuffle(numbers)
  c+=1
  for i, num in enumerate(numbers):
    if num == i:
      a+=1
  if not c % 1000:
    print('avg:', a/c, 'c =', c)

After 2 million trails, my simulated expected value was 0.9992347, or 1.
Question
I'm looking to prove this mathematically, and feel I should be using Bayes Theorem for this. 
On an unrelated note; if I remember correctly, expected value can be calculated as follows:
$$\sum_{i=1}^{n=10} P(i=arr[i])$$
My idea is that $P(i=arr[i]) = 1/10$ and so the sum of ten of those is 1. However I feel that if an element is already selected, then its probability drops to zero for all subsequent elements, so the probability is something like:
$$P(i=arr[i])=
\begin{cases}
1/(10-i),  & \text{if $index(i)\gt i$} \\
0, & \text{if $index(i)<i$}
\end{cases}
$$
 A: It is indeed $1$ and, moreover, this does not depend on $10$...it's true for any length.
This follows from Linearity of Expectation.  Let $X_i$ be the indicator variable for the $i^{th}$ slot, so $X_i=1$ if $i$ ends up in the $i^{th}$ slot, and $0$ otherwise.  Then, if we had $N$ slots, we see that $$E=E\left[\sum X_i\right]=\sum E[X_i]=N\times \frac 1N=1$$
Since $E[X_i]=\frac 1N$ for each $i$.
A: We can do this fairly directly. By linearity of expectation, the expected number of elements fixed by a permutation (a random shuffle of entries) is the sum of the probability that any given element is fixed. 
So what is the probability that $n$ (the last entry) is fixed by a random permutation? There are $n!$ permutations on a list of size $n$, and if we look for permutations that fix $n$ we find that they're really permutations of $\{1, 2, 3, ... n-1\}$, ie they just rearrange the first elements and ignore the last. There are $(n-1)!$ such permutations. Therefore the probability of fixing the last element is $1/n.$
But the last element isn't special! By rearranging we get the same probability for any index. Summing over the $n$ entries we get our expected value of $n * 1/n =1.$
A: Let $X = $ number of elements equal to its location in the array
I think Python starts counting from zero but let's just say the first spot is location 1.
Then $X = \sum_{i=1}^{10} X_i$ where $X_i = 1$ if you get a match in the ith location.
Then using linearity of expectation,
$$E[X] = E\bigg[\sum_{i=1}^{10} X_i\bigg] = \sum_{i=1}^{10} E[X_i] = \sum_{i=1}^{10} P(X_i = 1)$$
Each of the $X_i$'s are dependent on each other, for if you know that the first 9 are a match then the last one has to be as well.
So $P(X_2=1|X_1=1) \neq P(X_2=1)$
However, because we are interested in the unconditional probability of $P(X_i=1)$ and each location is equally likely to be a match,
$$P(X_i=1) = \frac{1}{10}$$
Therefore 
$$E[X] = 10\frac{1}{10}=1$$
Let me know if you have any doubts or issues with that solution. =)
