#include <bits/stdc++.h>
using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define SZ(x) static_cast<int>((x).size())

template<class T, size_t D>
struct vec : vector<vec<T, D - 1>> {
  template<class... Args>
  vec(size_t n = 0, Args... args)
      : vector<vec<T, D - 1>>(n, vec<T, D - 1>(args...)) {}
};
template<class T>
struct vec<T, 1> : vector<T> {
  template<class... Args>
  vec(Args... args)
      : vector<T>(args...) {}
};

template<class T>
inline bool Minimize(T& a, const T& b) { return a > b ? a = b, true : false; }
template<class T>
inline bool Maximize(T& a, const T& b) { return a < b ? a = b, true : false; }
inline int Next(int i, int n) { return i == n - 1 ? 0 : i + 1; }
inline int Prev(int i, int n) { return !i ? n - 1 : i - 1; }

mt19937 rng(static_cast<uint32_t>(chrono::steady_clock::now().time_since_epoch().count()));

template<class X, class Y, class T>
struct BIT2D {
  vec<X, 1> compressed_xs;
  vec<Y, 2> compressed_ys_groups;
  vec<T, 2> a;
  BIT2D(const vec<pair<X, Y>, 1>& points = vec<pair<X, Y>, 1>()) {
    for (auto& point : points) {
      compressed_xs.emplace_back(point.first);
    }
    sort(ALL(compressed_xs)); compressed_xs.erase(unique(ALL(compressed_xs)), compressed_xs.end());
    compressed_ys_groups.resize(SZ(compressed_xs));
    for (auto& point : points) {
      for (int i = static_cast<int>(lower_bound(ALL(compressed_xs), point.first) - compressed_xs.begin()); i < SZ(compressed_xs); i |= i + 1) {
        compressed_ys_groups[i].emplace_back(point.second);
      }
    }
    for (auto& compressed_ys : compressed_ys_groups) {
      sort(ALL(compressed_ys)); compressed_ys.erase(unique(ALL(compressed_ys)), compressed_ys.end());
    }
    a = compressed_ys_groups;
    for (auto& i : a) {
      fill(ALL(i), T());
    }
  }

  template<class U>
  void Add(X x, Y y, U value) {
    for (int i = static_cast<int>(lower_bound(ALL(compressed_xs), x) - compressed_xs.begin()); i < SZ(compressed_xs); i |= i + 1) {
      for (int j = static_cast<int>(lower_bound(ALL(compressed_ys_groups[i]), y) - compressed_ys_groups[i].begin()); j < SZ(compressed_ys_groups[i]); j |= j + 1) {
        a[i][j] += value;
      }
    }
  }
  T Get(X x, Y y) const {
    T ret{};
    for (int i = static_cast<int>(upper_bound(ALL(compressed_xs), x) - compressed_xs.begin()) - 1; ~i; i = (i & (i + 1)) - 1) {
      for (int j = static_cast<int>(upper_bound(ALL(compressed_ys_groups[i]), y) - compressed_ys_groups[i].begin()) - 1; ~j; j = (j & (j + 1)) - 1) {
        ret += a[i][j];
      }
    }
    return ret;
  }
  T Get(X x_1, Y y_1, X x_2, Y y_2) const {
    return x_1 > x_2 || y_1 > y_2 ? 0 : Get(x_2, y_2) + Get(x_1 - 1, y_1 - 1) - Get(x_2, y_1 - 1) - Get(x_1 - 1, y_2);
  }
};

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);

  int n; cin >> n;
  vec<pair<int, int>, 1> b(n);
  for (int i = 0; i < n; ++i) {
    string s; cin >> s;
    int64_t a = 0;
    for (int j = 0; j < SZ(s); ++j) {
      if (s[j] == '.') {
        a *= 1000000000;
        int tmp = 0;
        for (int k = j + 1; k < SZ(s); ++k) {
          tmp = tmp * 10 + s[k] - '0';
        }
        for (int k = SZ(s) - (j + 1); k < 9; ++k) {
          tmp *= 10;
        }
        a += tmp;
        break;
      }
      a = a * 10 + s[j] - '0';
    }
    if (!count(ALL(s), '.')) {
      a *= 1000000000;
    }
    for (; !(a & 1); a >>= 1) {
      --b[i].first;
    }
    for (; !(a % 5); a /= 5) {
      --b[i].second;
    }
  }

  BIT2D<int, int, int> bit2D(b);

  int64_t answer = 0;
  for (int i = 0; i < n; ++i) {
    answer += bit2D.Get(-b[i].first - 18, -b[i].second - 18);
    bit2D.Add(b[i].first, b[i].second, 1);
  }

  cout << answer << '\n';

  return 0;
}

Measured memory_bytes: 8220