Math, asked by a4aakash, 3 months ago

You are given an array A of N integers. You can perform the following operation as many times as you like:- Choose two indices i and j (1 <= i < j <= N), replace A[i] by A[i] OR A[j] and replace A[j] by A[i] AND A[j]. (where OR and AND are logical operators). All you need to do is find the maximum value of sum of squares of all integers in array A. Input The first line of the input contains an integer N, the number of integers in the array. The second line of the input contains N non- negative integers of the array A. Constraints 1 <= N <= 100000 0 <= A[i] <= 1000000 Output Output a single integer, the maximum value for the sum of squares after performing the above defined operation.
Example:-
3
1 3 5
Output :-
51

Answers

Answered by 1999sahare
0

Step-by-step explanation:

You are given two arrays A and B consisting of N integers numbered from 0 to (N-1) and an integer X.

It is given that initially the value of X is zero.

Similar questions