let rec fix f x = f (fix f) x

let modulo = 1000000007
let ( *@) a b = a * b mod modulo
let rec ( **@) a n = 
  if n = 0 then 1
  else if n mod 2 = 1 then a *@ a **@ (n-1)
  else let h = a **@ (n/2) in h *@ h
let (/@) a b = a *@ (b **@ (modulo-2))

module M = Map.Make(struct type t = int let compare = (-) end)


let rec factorize x =
  fix (fun f d y m -> 
    if y = 1 || d * d > x then
      if y > 1 then M.add y 1 m else m
    else 
      let c, y = fix (fun g (c, y) ->
        if y mod d > 0 then (c, y) else g (c+1, y / d)) (0, y) in
      f (d+1) y (if c = 0 then m else M.add d c m)) 2 x M.empty

let lcm =
  M.merge (fun k da db ->
    match da, db with
    | Some p, Some q -> Some (max p q)
    | Some p, None -> Some p
    | None, Some q -> Some q
    | _ -> None)

let div =
  M.merge (fun k da db ->
    match da, db with
    | Some p, Some q -> Some (p-q)
    | Some p, None -> Some p
    | _ -> raise (Invalid_argument "foo"))

let to_int m = M.fold (fun k v a -> k **@ v *@ a) m 1

let () =
  Scanf.scanf "%d" @@ fun n ->
  let a = Array.init n (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  let fa = Array.map factorize a in
  let m = Array.fold_left (fun m v -> lcm m v) M.empty fa in
  Array.fold_left (fun acc v -> (acc + to_int (div m v)) mod modulo) 0 fa
  |> Printf.printf "%d\n"
