How many Gravity Falls episodes are there?

There were 40 episodes in Gravity Falls' run.