#include <cstdio>
#include <algorithm>
using namespace std;

int f[100005]={};

int main() 
{
    int n;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d",&f[i]);
    }
    sort(f,f+n);
    long long fn=0;
    int j=0;
    for(int i=0; i<n; i++)
    {
          if(j<=i)
              j=i+1;
        for(; j<n; j++)
        {
            if(f[i]*10 >= f[j]*9)
                continue;
            else
                break;
        }
        fn+=(long long)j-i-1;
    }
    printf("%lld\n",fn);
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: