func_code_string: /*       Author - Param Kothari       Ah shit, here we go again   */      #include <bits/stdc++.h>       using namespace std;      #define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);   #define pb push_back   #define mk make_pair      typedef long long ll;   typedef long double ld;      void solve(){       int n;       cin >> n;       vector<int> a(n);       for(int i = 0; i < n; i++){           cin >> a[i];       }       vector<ll> c(n + 1);       for(int i = 0; i < n; i++){           c[a[i]]++;       }       vector<ll> pref(n + 2);       for(int i = 1; i <= n; i++){           pref[i] = pref[i - 1] + c[i];       }       ll res = 0;       auto nC2 = [&](ll x){           return (x * (x - 1)) / 2;       };       auto nC3 = [&](ll x){           return (x * (x - 1) * (x - 2)) / 6;       };       for(int i = 1; i <= n - 2; i++){           ll l = i, r = i + 2;           ll cnt = pref[r - 1] - pref[l];           res += 1LL * c[l] * c[r] * cnt;           res += 1LL * nC2(c[l]) * c[r];           res += 1LL * c[l] * nC2(c[r]);       }       for(int i = 1; i <= n - 1; i++){           ll l = i, r = i + 1;           res += 1LL * nC2(c[l]) * c[r];           res += 1LL * c[l] * nC2(c[r]);       }       for(int i = 1; i <= n; i++){           res += 1LL * nC3(c[i]);       }       cout << res <<   n ;       return;   }      int main(){       IOS;       int t = 1;       cin >> t;       for(int i = 1; i <= t; i++){           solve();       }       return 0;   }