//#8855496参照
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC147d
{
    class Program
    {
        static void Main()
        {
            int mod = 1000000007;
            int n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long sum = 0;
            for (int bit=0; bit <= 61; bit++)
            {
                //aiごとに処理しなくてもまとめてsumに足せる
                long count = a.Count(x => (x & (1L << bit)) != 0);
                sum += (count * (n - count)) * (1L << bit);
                sum = sum%mod;
            }
            Console.WriteLine(sum);
            //Console.ReadLine();
        }
    }
}
