    from fractions import gcd
    # from datetime import date, timedelta
    from heapq import*
    import math
    from collections import defaultdict, Counter, deque
    from bisect import *
    import itertools
    import sys
    sys.setrecursionlimit(10 ** 7)
    MOD = 10 ** 9 + 7
    # input = sys.stdin.readline
     
     
    def main():
        n = int(input())
        a = list(map(int, input().split()))
     
        ans = 0
        for i in range(60):
            one,zero = 0,0
            for j in range(n):
                if ((1 << i) & a[j]) == (1 << i):
                    one +=1
                else:
                    zero += 1
            ans += (1 << i) * one * zero
            ans %= MOD
        print(ans)
     
     
    if __name__ == '__main__':
        main()