package main

import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt() int {
  n, _ := strconv.Atoi(NextLine())
  return n
}
func NextIntVec() []int {
  L := strings.Split(NextLine(), " ")
  N := make([]int, len(L))
  for i := range N {
    N[i], _ = strconv.Atoi(L[i])
  }
  return N
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func Output() {
  _ = writer.Flush()
}

const p = 1000000007

func main() {
  N := NextInt()
  A := NextIntVec()
  B := make([][]int, N)
  for i, a := range A {
    B[i] = make([]int, 60)
    for j := range B[i] {
      B[i][j] = a % 2
      a /= 2
    }
  }
  ans := 0
  for j := 0; j < 60; j++ {
    b := make([]int, 2)
    for i := range B {
      b[B[i][j]]++
    }
    ans += 1 << uint(j) * (b[0] * b[1] % p) % p
    ans %= p
  }
  Write(ans)
  Output()
}