Scanf.scanf "%d" (fun n ->
    let k = 18 in
    let mat = Array.make_matrix (k + 1) (k + 1) 0 in
    let fact a =
        let rec loop_5 i acc2 acc5 =
            if i mod 5 = 0 then loop_5 (i / 5) acc2 (acc5 + 1) else acc2, acc5
        in
        let rec loop_2 i acc =
            if i mod 2 = 0 then loop_2 (i / 2) (acc + 1) else loop_5 i acc 0
        in
        loop_2 a 0
    in

    let rec loop i acc =
        if i = n then acc else
            let acc = Scanf.scanf " %f" (fun f ->
                let (d2, d5) = fact (int_of_float (f *. 1000000000. +. 0.5)) in
                let d2 = min d2 k in
                let d5 = min d5 k in
                mat.(d2).(d5) <- mat.(d2).(d5) + 1;
                if d2 * 2 >= k && d5 * 2 >= k then acc + 1 else acc
            )
            in
            loop (i + 1) acc
    in
    let acc = loop 0 0 in
    let sum = Array.make_matrix (k + 1) (k + 1) 0 in
    sum.(k).(k) <- mat.(k).(k);
    for i = k - 1 downto 0 do
        sum.(i).(k) <- sum.(i + 1).(k) + mat.(i).(k);
        sum.(k).(i) <- sum.(k).(i + 1) + mat.(k).(i);
    done;
    for y = k - 1 downto 0 do
        for x = k - 1 downto 0 do
            sum.(y).(x) <- mat.(y).(x) + sum.(y + 1).(x) + sum.(y).(x + 1) - sum.(y + 1).(x + 1)
        done
    done;

    let rec loop_2 i2 acc =
        let rec loop_5 i5 acc =
            if i5 = k + 1 then loop_2 (i2 + 1) acc else
                let acc = acc + mat.(i2).(i5) * sum.(k - i2).(k - i5) in
                loop_5 (i5 + 1) acc
        in
        if i2 = k + 1 then acc else loop_5 0 acc
    in
    let res = loop_2 0 0 in
    Printf.printf "%d\n" @@ (res - acc) / 2
)