Expected number of events that happens equals sum of probabilities

I'm struggling with the following homework question. Let $$A_1,A_2,...,A_n$$ be a finite sequence of events and let $$N$$ denote the number of events which occur. I have to show the following: $$\mathbb{E}[N]=\sum_{i=1}^n\mathbb{P}(A_i)$$ The question appears in a paragraph about the indication function so I tried use that but I couldn't manage to figure it out. Also, the principle of inclusion and exclusion didn't get me any further. Could any of you give my a tip on how to solve this?

Hint: $$N = \sum_{i=1}^n 1_{A_i},$$ so finish the question with the linearity of expectation, and the property $$E[1_A] = P(A)$$.