Maximize sum of Bitwise AND of same-indexed elements of a permutation of first N natural numbers and a given array
Given an array arr[] consisting of N positive integers, the task is to find the maximum sum of Bitwise AND of same-indexed elements of permutation of the first N natural numbers and the array arr[]. Examples: Input: arr[] = {4, 2, 3, 6}Output: 5Explanation: Consider the permutation {1, 0, 3, 2}. Sum