36 lines
630 B
C++
36 lines
630 B
C++
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int a[100000];
|
|
|
|
int main() {
|
|
ios_base::sync_with_stdio(false);
|
|
cin.tie(NULL);
|
|
freopen("ghepcap.inp", "r", stdin);
|
|
|
|
int n;
|
|
cin >> n;
|
|
for (int i = 0; i < n; i++)
|
|
cin >> a[i];
|
|
sort(a, a + n);
|
|
// 89 90 91 99 100 101
|
|
int res = 0;
|
|
for (int j = 0; j < n; j++) {
|
|
int l = 0, r = j;
|
|
// int ans = a[n - 1];
|
|
while (l < r) {
|
|
int mid = (l + r) / 2;
|
|
if (10 * a[mid] < a[j] * 9) {
|
|
l = mid + 1;
|
|
} else {
|
|
r = mid;
|
|
// ans = min(ans, mid);
|
|
}
|
|
}
|
|
// res += j - ans;
|
|
res += j - l;
|
|
}
|
|
cout << res << '\n';
|
|
}
|