using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp2
{


    public class Program
    {

        static long D = (long)Math.Pow(10, 9) + 7;

        public static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] nString = Console.ReadLine().Split(' ');
            long[] As = new long[N];

            for (int i = 0; i < N; i++)
            {
                As[i] = long.Parse(nString[i]);
            }

            long ans = 0;
            for (int d = 0; d < 60; d++)
            {
                int n0 = 0;
                int n1 = 0;
                for (int i = 0; i < N; i++)
                {
                    long n = As[i]>>d &1;
                    if (n == 0) n0++;
                    if (n == 1) n1++;
                }

                long preAns = n0 * n1;
                for (int i = 1; i <= d; i++)
                {
                    preAns *= 2;
                    preAns %= D;
                }
                ans += preAns;
            }

            Console.WriteLine(ans);
            Console.ReadLine();

        }

        private static int[] Read(string input)
        {
            string[] strings = input.Split(' ');
            int num = strings.Length;
            int[] ints = new int[num];
            for (int i = 0; i < num; i++)
            {
                ints[i] = int.Parse(strings[i]);
            }
            
            return ints;
        }


    }


}
