using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC147
{
    class Program
    {
        static void Main(string[] args)
        {
            d();
        }

       

        public static void d()
        {
            double w = Math.Pow(10, 9) + 7;
            int n = int.Parse(Console.ReadLine());
            long[] a = Console.ReadLine().Split(' ').Select(b => long.Parse(b)).ToArray();
            long sum = 0;
            for(int i = 0; i < a.Length - 1; i++)
            {
                for(int j = i + 1; j < a.Length; j++)
                {
                    //long x = long.Parse(Convert.ToString(a[i], 2));
                    //long y = long.Parse(Convert.ToString(a[j], 2));
                    sum += a[i] ^ a[j];
                }
            }
            double ans = sum % w;
            Console.WriteLine(ans);
        }
    }
}
