import java.io.BufferedReader
import java.math.BigDecimal
import java.util.*
import kotlin.system.exitProcess

fun main() = agc047a()

@OptIn(ExperimentalStdlibApi::class)
fun agc047a() = SimpleFastIOWithToken_agc047a().exec {
    val n = readInt()
    val aList = List(n) { readString() }

    tailrec fun Long.divCount(x: Long, count: Int = 0): Int {
        return when {
            x <= 1L -> error("unexpected")
            this % x == 0L -> (this@divCount / x).divCount(x, count + 1)
            else -> count
        }
    }

    val bd1e9 = BigDecimal.valueOf(1_000_000_000)
    val aMultiplied = aList.map { BigDecimal(it).setScale(100).multiply(bd1e9).longValueExact() }
    val appeared = mutableMapOf<Pair<Int, Int>, Long>().withDefault { 0L }

    for (am in aMultiplied) {
        val pair = am.divCount(2) to am.divCount(5)
        appeared[pair] = appeared.getValue(pair) + 1
    }

    val checked = mutableMapOf<Pair<Pair<Int, Int>, Pair<Int, Int>>, Boolean>().withDefault { false }
    var answer = 0L

    for ((key1, time1) in appeared) for ((key2, time2) in appeared) {
        if (key1.first + key2.first >= 18 && key1.second + key2.second >= 18) {
            if (key1 to key2 in checked || key2 to key1 in checked) continue
            answer += if (key1 == key2) time1 * (time1 - 1) / 2 else time1 * time2
            checked.merge(key1 to key2, true, Boolean::or)
        }
    }

    println(answer)
}

// region kokokara template dayo (^o^)
@Suppress("unused", "HasPlatformType", "MemberVisibilityCanBePrivate", "ClassName")
private class SimpleFastIOWithToken_agc047a(private val separator: String = System.lineSeparator()) {
    private val br: BufferedReader = System.`in`.bufferedReader()
    private var st: StringTokenizer = StringTokenizer("")
    private val sb: StringBuilder = StringBuilder()
    private fun prepareNext() = run { if (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) }

    fun readString(): String = run { prepareNext() }.run { st.nextToken() }
    fun readStringList(size: Int): List<String> = List(size) { readString() }
    fun readInt(): Int = Integer.valueOf(readString())
    fun readIntList(size: Int): List<Int> = List(size) { readInt() }
    fun readLong(): Long = java.lang.Long.valueOf(readString())
    fun readLongList(size: Int): List<Long> = List(size) { readLong() }
    inline fun <reified T> readArray(size: Int, init: () -> T) = Array(size) { init() }
    inline fun <T> readList(size: Int, init: () -> T) = List(size) { init() }

    fun println(): Unit = run { sb.append(separator) }
    fun print(any: Any): Unit = run { sb.append(any) }
    fun println(any: Any): Unit = run { sb.append(any.toString() + separator) }

    fun exec(action: SimpleFastIOWithToken_agc047a.() -> Unit) = run {
        Thread(null, { action() }, "(^o^)", 128 * 1024 * 1024)
            .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); exitProcess(1) } }
            .apply { start() }.join()
    }.run { kotlin.io.print(sb) }

    fun readLine(): Nothing = error("readLine is disabled.")
}
// endregion kokomade template dayo (^o^)
