Limits 1s, 512 MB

Little Arya loves to play with numbers. She likes to play in different ways with them. One day she started playing with numbers by bitwise OR operation. The game is that, she has N numbers. She will choose some random group of numbers from those N numbers. She will apply Bitwise OR operation between them and get a resultant number M.

Now, she wants to know the maximum value of M that she can find out from that arbitrary group of numbers after applying Bitwise OR operation.

Input

At first your program will take T as a test case (1 ≤ T ≤ 10). Then it will take input for each test case. First line of test case will take N (1 ≤ N ≤ 100). Next line has N numbers (0 ≤ Ni ≤ 106)

Output

At first print test case number just like sample output “Case X: ”, X is the test case number , with the maximum numbers M as described in the problem.

Sample

InputOutput
2
2 
2 3
2
7 8
Case 1: 3
Case 2: 15

Bitwise OR ( | ) operation

A	B	Result
0	0	0
0	1	1
1	0	1
1	1	1

Submit

Login to submit.

Statistics

94% Solution Ratio
minhaz110Earliest, Jun '16
Bishal_GFastest, 0.0s
asfaklus2Lightest, 0 B
ShuddhoShortest, 101B
Toph uses cookies. By continuing you agree to our Cookie Policy.