program integer_product
  implicit none
  integer :: n, p2(200000) = 0, p5(200000) = 0, i, j, m
  integer :: map(-30:30, -30:30) = 0
  integer(8) :: a
  character(16) :: s
  read(*,*) n
  do i = 1, n
    read(*,*) s
    m = len_trim(s)
    do j = 1, m
      if (s(j:j) == '.') then
        p2(i) = j - m
        p5(i) = j - m
        s(j:m - 1) = s(j + 1:m)
        s(m:) = ''
        exit
      end if
    end do
    read(s,*) a
    do while (mod(a, 2_8) == 0)
      a = a / 2
      p2(i) = p2(i) + 1
    end do
    do while (mod(a, 5_8) == 0)
      a = a / 5
      p5(i) = p5(i) + 1
    end do
    map(p2(i), p5(i)) = map(p2(i), p5(i)) + 1
  end do
  a = 0
  do i = 1, n
    map(p2(i), p5(i)) = map(p2(i), p5(i)) - 1
    a = a + sum(map(-p2(i):, -p5(i):))
  end do
  write(*,'(i0)') a
end program integer_product