#C6879. OR Gate Evaluation
OR Gate Evaluation
OR Gate Evaluation
You are given an integer N
and a sequence of N
binary digits (0 or 1). Your task is to compute the result of applying the bitwise OR operation over all the bits.
Mathematically, if the bits are \(a_1, a_2, \ldots, a_N\), you need to compute:
If at least one of the bits is 1, the result is 1; otherwise, it is 0.
Input is given via stdin and output should be produced on stdout.
inputFormat
The first line of input contains an integer N
representing the number of bits.
The second line contains N
space-separated integers, each being either 0 or 1.
outputFormat
Print a single integer: the result of the bitwise OR operation on the N
bits.
5
0 0 0 1 0
1