#include using namespace std; using i64 = long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); auto solve = [&]() { int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); i64 ans = 0; for (int i = 0, j = 0; i < n; i = j) { while (j < n && a[i] == a[j]) { j++; } ans += 1LL * (j - i) * (j - i - 1) / 2 * (lower_bound(a.begin(), a.end(), 2 * a[i]) - a.begin() - (j - i)); } cout << ans << '\n'; }; solve(); return 0; }