Problem G
Game Party
It’s game night and you’re inviting all your friends over. To play the game you have to divide yourself and all your friends into teams of three. You’re nervous that it won’t be possible to get everyone a full team, so you count everyone at your door as they arrive in groups of different sizes. Find out how many will have to sit and watch because they can’t form a full team.
Input
The first line consists of one integer $G$, the number of groups arriving. Next follows one line with $G$ integers $S_ i$, each denoting the size of the arriving group.
Output
Output the number of people that are not able to join a full team.
Limits

$0 \leq G \leq 100\, 000$

$0 < S_ i \leq 1\, 000$
Sample Input 1  Sample Output 1 

3 2 3 3 
0 
Sample Input 2  Sample Output 2 

2 1 3 
2 