#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

MAX = 10**9 + 7

def main():
  n = int(input())
  As = map(int, input().strip().split())
  counts = numpy.zeros(60)
  for A in As:
    i = 0
    while A:
      if A%2 == 1:
        counts[-(i+1)] += 1
      A >>= 1
      i += 1
  print(int(sum([(n-count) * count * (2**(60-(i+1)) % MAX) for i, count in  enumerate(counts)])) % MAX)

if __name__=='__main__':
  main()