#include <iostream>
#include <vector>
#include <unordered_map>
#include <deque>
#include <list>
#include <set>
#include <random>
#include <deque>

using namespace std;
using ll = long long;
const int BIG = 100000007;


int main() {
    ll n;
    cin >> n;
    /*
    vector<vector<ll>> numec(10,vector<ll>(10,0));

    vector<vector<ll>> denomic(10,vector<ll>(10,0));
     */

    vector<vector<vector<vector<ll>>>> fraction(10,vector<vector<vector<ll>>>(10,vector<vector<ll>>(10,vector<ll>(10,0))));


    for(ll i = 0;i < n;++i) {
        string s;
        cin >> s;
        auto p = s.find('.');
        if (p != string::npos) {
          //  cout << "syousuu" << endl;

            ll a1 = 0;
            ll a2 = 0;
            ll a3 = 1;

            for (ll j = 0; j < p; ++j) {
                a1 *= 10;
                a1 += (s[j] - '0');
            }

            for (ll j = p + 1; j < s.length(); ++j) {
                a2 *= 10;
                a3 *= 10;
                a2 += (s[j] - '0');
            }

            if(a2 == 0){
               // cout << "yappa seisuu" << endl;

                ll d3 = 0;
                ll d4 = 0;

                while (a1 % 2 == 0) {
                    ++d3;
                    a1 /= 2;
                }
                while (a1 % 5 == 0) {
                    ++d4;
                    a1 /= 5;
                }

                if (d3 >= 10)d3 = 9;

               // ++denomic[0][0];
               // ++numec[d3][d4];
                ++fraction[d3][d4][0][0];
               // cout << "d3 = " << d3 << ",d4 = " << d4 << endl;
            }
            else{
                ll l1 = a2;
                ll l2 = a3;

                //cout << "l1 = " << l1 << ",l2 = " << l2 << endl;

                while (l1 < l2) {
                    ll v1 = l2 % l1;
                    if(v1 == 0){
                        l2 = l1;
                    }
                    else{
                        l2 = l1;
                        l1 = v1;
                    }
                }

                // cout << "l1 = " << l1 << ",l2 = " << l2 << endl;


                ll b2 = a2 / l2;
                ll b3 = a3 / l2;
                ll b1 = a1 * b3 + b2;


              //  cout << "b1 = " << b1 << ",b2 = " << b2 << ",b3 = "  << b3 << endl;

                ll b3d1 = 0;
                ll b3d2 = 0;

                while (b3 % 2 == 0) {
                    ++b3d1;
                    b3 /= 2;
                }
                while (b3 % 5 == 0) {
                    ++b3d2;
                    b3 /= 5;
                }

                ll b1d1 = 0;
                ll b1d2 = 0;

                while (b1 % 2 == 0) {
                    ++b1d1;
                    b1 /= 2;
                }
                while (b1 % 5 == 0) {
                    ++b1d2;
                    b1 /= 5;
                }

                if (b1d1 >= 10)b1d1 = 9;

               // ++denomic[b3d1][b3d2];
               // ++numec[b1d1][b1d2];
                       ++fraction[b1d1][b1d2][b3d1][b3d2];

              //  cout << "b1d1 = " << b1d1 << ",b1d2 = " << b1d2 << ",b3d1 = "  << b3d1 << ",b3d2 = " << b3d2<< endl;
            }

        } else {
          //  cout << "seisuu" << endl;

            ll a1 = 0;

            for (ll j = 0; j < s.length(); ++j) {
                a1 *= 10;
                a1 += (s[j] - '0');
            }

            ll d3 = 0;
            ll d4 = 0;

            while (a1 % 2 == 0) {
                ++d3;
                a1 /= 2;
            }
            while (a1 % 5 == 0) {
                ++d4;
                a1 /= 5;
            }

            if (d3 >= 10)d3 = 9;

            ++fraction[d3][d4][0][0];

          //  cout << "d3 = " << d3 << ",d4 = " << d4 << endl;
        }
    }

    ll result = 0;
    ll integcount = 0;

    for(ll i1 = 0;i1 < 10;++i1) {
        for(ll i2 = 0;i2 < 10;++i2) {
            for(ll i3 = 0;i3 < 10;++i3) {
                for(ll i4 = 0;i4 < 10;++i4) {
                    for(ll j1 = i3;j1 < 10;++j1){
                        for(ll j2 = i4;j2 < 10;++j2){
                            for(ll j3 = 0;j3 <= i1;++j3){
                                for(ll j4 = 0;j4 <= i2;++j4) {
                                    ll o = fraction[i1][i2][i3][i4] * fraction[j1][j2][j3][j4];;
                                    if(o > 0){
                                       // cout << "[" << i1 << "," << i2 << "," << i3 << "," << i4 << "],[" << j1 << "," << j2 << "," << j3 << "," << j4 << "],o = "  << o << endl;
                                        result += o;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            integcount += fraction[i1][i2][0][0];
        }
    }
   // cout << result << endl;
  //  cout << integcount << endl;


    cout << (result - integcount) / 2 << endl;




}




Measured memory_bytes: 3300