#ifdef __LOCAL #define _GLIBCXX_DEBUG #include "debug2.h" #endif #ifndef __LOCAL #define show(...) #define SET_GROUP(x) #define SET_MAXCNT(x) #endif #include using namespace std; //#include //using namespace atcoder; //#include //using bigint = boost::multiprecision::cpp_int; #define SIZE(x) (int)(x.size()) #define ALL(x) x.begin(),x.end() using ll = long long; //int di[] = {1, 0, -1, 0, 1, -1, -1, 1}; //int dj[] = {0, 1, 0, -1, 1, 1, -1, -1}; templatebool chmin(T& x,T y){if(x>y){x=y;return true;}return false;} templatebool chmax(T& x,T y){if(xvectormatrix(int n1,T val){return vector(n1,val);} templatevector>matrix(int n1,int n2,T val){return vector>(n1,matrix(n2,val));} templatevector>>matrix(int n1,int n2,int n3,T val){return vector>>(n1,matrix(n2,n3,val));} templatevector>>>matrix(int n1,int n2,int n3,int n4,T val){return vector>>>(n1,matrix(n2,n3,n4,val));} templateT sum(vectorx){T r=0;for(auto e:x)r+=e;return r;} templateT max(vectorx){T r=x[0];for(auto e:x)chmax(r,e);return r;} templateT min(vectorx){T r=x[0];for(auto e:x)chmin(r,e);return r;} templatesettoSet(vectorx){set r;for(auto e:x)r.emplace(e);return r;} templatemaptoMap(vectorx){mapmp;for(auto e:x)mp[e]++;return mp;} templatevectortoVector(setx){vector r;for(auto e:x)r.push_back(e);return r;} templatepair operator+(pairx,pairy){return make_pair(x.first+y.first,x.second+y.second);} templatepair operator-(pairx,pairy){return make_pair(x.first-y.first,x.second-y.second);} templateistream&operator>>(istream&is,tuple&x){cin>>get<0>(x)>>get<1>(x);return is;} templateistream&operator>>(istream&is,tuple&x){cin>>get<0>(x)>>get<1>(x)>>get<2>(x);return is;} templateistream&operator>>(istream&is,pair&x){cin>>x.first>>x.second;return is;} templateistream&operator>>(istream&is,vector&x){for(auto&&e:x)is>>e;return is;} templateistream&operator>>(istream&is,vector>&x){for(auto&&e:x)for(auto&&f:e)is>>f;return is;} templateostream&operator<<(ostream&os,const vector&x){for(auto e:x)os<ostream&operator<<(ostream&os,const vector>&x){for(auto e:x){for(auto f:e)os<> n; vector a(n); cin >> a; sort(ALL(a)); map mp = toMap(a); ll ans = 0; for(const auto& [e, f] : mp){ ll tmp = f * (f - 1) / 2; //1~2*e-1 ll cnt = lower_bound(ALL(a), 2 * e) - a.begin() - f; chmax(cnt, 0LL); tmp *= cnt; ans += tmp; } cout << ans << endl; return 0; }