Here is the solution to the problem Priya and AND:

Python

The Solution in C++

```
#include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while (t>0){
int n;
cin >> n;
int arr[n];
for (int i=0;i<n;i++){
scanf("%d",&arr[i]);
}
int c=0;
for (int i=0;i<n;i++){
for (int j=0;j<n;j++){
if (i<j and (arr[i]&arr[j])==arr[i]){
c++;
}
}
}
cout << c << "\n";
t--;
}
return 0;
}
```