#include<bits/stdc++.h> #define fst first #define snd second #define re register #define int long long
usingnamespace std;
typedef pair<int,int> pii; constint N = 2e5 + 10; int T,n;
inlineintread(){ int r = 0,w = 1; char c = getchar(); while (c < '0' || c > '9'){ if (c == '-') w = -1; c = getchar(); } while (c >= '0' && c <= '9'){ r = (r << 3) + (r << 1) + (c ^ 48); c = getchar(); } return r * w; }
inlinevoidsolve(){ int ans = 0; map<pii,int> vis; n = read(); for (re int i = 1;i <= n;i++){ int x,t,num = 0; x = t = read(); while (t % 2 == 0){ num++; t >>= 1; } vis[{t,x - num}]++; } for (auto it = vis.begin();it != vis.end();it++){ int cnt = it -> second; ans += cnt * (cnt - 1) / 2; } printf("%lld\n",ans); }
signedmain(){ T = read(); while (T--) solve(); return0; }