#C8025. Magical Moves on Bookshelves

    ID: 51962 Type: Default 1000ms 256MiB

Magical Moves on Bookshelves

Magical Moves on Bookshelves

You are given n bookshelves and an array of integers representing the number of books on each shelf. A bookshelf is considered empty if it contains 0 books. Your task is to determine the minimum number of magical moves required so that no bookshelf is empty. In each magical move, you can magically add a book to an empty shelf. Thus, the answer is simply the number of empty shelves.

Mathematically, if the array is \( A = [A_1, A_2, \dots, A_n] \), then the minimum number of moves required is \[ \text{moves} = \sum_{i=1}^{n} \mathbf{1}_{\{A_i = 0\}}, \] where \( \mathbf{1}_{\{A_i = 0\}} \) is 1 if \( A_i = 0 \) and 0 otherwise.

inputFormat

The input is read from standard input (stdin) and consists of two lines:

  • The first line contains a single integer n — the number of bookshelves.
  • The second line contains n space-separated integers where each integer represents the number of books on that shelf. If n is 0, the second line will be empty.

outputFormat

Output a single integer to standard output (stdout) which is the minimum number of magical moves required to ensure that no bookshelf is empty.

## sample
5
1 2 3 4 5
0