Problem:
Score : 300 points

Problem Statement

You are given N real values A_1, A_2, \ldots, A_N.
Compute the number of pairs of indices (i, j)
such that i < j and the product A_i \cdot A_j is integer.

Constraints

2 \leq N \leq 200\,000

0 < A_i < 10^4

A_i is given with at most 9 digits after the decimal.

Input

Input is given from Standard Input in the following format.

N
A_1
A_2
\vdots
A_N

Output

Print the number of pairs with integer product A_i \cdot A_j (and i < j).

Sample Input 1

5
7.5
2.4
17.000000001
17
16.000000000

Sample Output 1

3

There are 3 pairs with integer product:

7.5 \cdot 2.4 = 18

7.5 \cdot 16 = 120

17 \cdot 16 = 272

Sample Input 2

11
0.9
1
1
1.25
2.30000
5
70
0.000000001
9999.999999999
0.999999999
1.000000001

Sample Output 2

8

Solution in C# (.NET Core 3.1.201) (judge verdict: Wrong Answer)

using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
namespace atcoder151
{
    public class MainClass
    {
        public static void Main(string[] args)
        {
            new MainClass().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            //var array = ReadLine().Split().Select(int.Parse).ToArray();
            //array.Count(x =>
            //{
            //    WriteLine(x.ToString());
            //    return true;
            //});

            //var counter = array.Where(_ => _ > 2).Count();
            //WriteLine(counter);
            int n = cin.ReadInt;
            string[] array = new string[n];
            for (int i = 0; i < n; i++)
            {
                array[i] = Console.ReadLine();
            }
            //var array = new double[n].Select(_ => Console.ReadLine().Split()).ToArray();
            int couter = 0;
            
            for (int i = 0; i < n; i++)
            {
                int len = n;
                double ans = 0;
                
                for (int j =  i + 1; j < len; j++) {
                    ans = double.Parse(array[i]) * double.Parse(array[j]);

                    if (ans - Floor(ans) == 0)
                    {
                        couter++;
                    }                   
                }
                len--;
            }

            WriteLine(couter);

            //var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //var s = new int[h[1]].Select(_ => Console.ReadLine().Split()).ToArray();
            ////WriteLine(h[0] + " " + h[1] + " " + h[2]);
            //var set = s.Where(x => x[1] == "AC").Select(x => x[0]).Distinct().ToHashSet();
            //var sum = s.Where(x => set.Contains(x[0])).GroupBy(x => x[0], x => x[1]).Sum(g => g.TakeWhile(x => x == "WA").Count());
            //Console.WriteLine($"{set.Count} {sum}");

        }



        public class ConsoleInput
        {
            //string[] arr;
            //int x;
            //int y;
            //        for (int i = 0; i<n; i++)
            //        {
            //            arr = Console.ReadLine().Split(' ').ToArray();
            //x = int.Parse(arr[0]);
            //y = int.Parse(arr[1]);
            //var power = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2));
            //            if (power <= d)
            //            {
            //                counter++;
            //            }
            //        }
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }

        }
    }
}