DMPG '17 B6 - Multiply and Surrender

View as PDF

Submit solution

Points: 7 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Roger has found N numbers, numbered A_1, A_2, A_3, \ldots A_{N-1}, A_N. Roger wants to know how many digits there are in the binary representation of the product A_1 \times A_2 \times A_3 \times \ldots \times A_{N-1} \times A_N. Help Roger find this number!

Input Specification

The first line will consist of a single integer, N.
The next line will consist of N space separated integers, A_1, A_2, \ldots A_{N-1}, A_N.

Output Specification

Print the number of digits in the binary representation of the product A_1 \times A_2 \times A_3 \times \ldots \times A_{N-1} \times A_N.

Subtasks

Subtask Points N A_i
1 10 1 \le N \le 10 1 \le A_i \le 10
2 90 1 \le N \le 10^5 1 \le A_i \le 10^{18}

Sample Input

5
2 2 2 2 2

Sample Output

6

Explanation of Sample Output

Let X_{dec} denote a decimal number and X_{bin} denote a binary number. 2_{dec} \times 2_{dec} \times 2_{dec} \times 2_{dec} \times 2_{dec} = 32_{dec} = 100000_{ bin}.


Comments

There are no comments at the moment.