package main

import (
	"fmt"

	"github.com/murosan/contest-util/cutil"
)

var mod uint64 = 1000000007

func main() {
	var n uint64
	fmt.Scan(&n)

	cutil.NewReader(int(n))
	a := cutil.ReadInts64(" ")

	var ans uint64
	for k := uint(0); k < 60; k++ {
		var x, y uint64
		for _, i := range a {
			if (uint64(i)>>k)&1 == 1 {
				x++
			} else {
				y++
			}
		}

		sum := (x * y) % mod
		sum = sum << k % mod
		ans = (ans + sum) % mod
	}

	fmt.Println(ans)
}
