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

namespace xor
{
    class Program
    {
        static void Main(string[] args)
        {
            var count = int.Parse(Console.ReadLine());

            var nums = Console.ReadLine().Split(' ').Select(c => long.Parse(c)).ToList();

            var sum = EnumerateCombination(nums.Select((n,i) => new Num(n, i)), 2)
                        .Select(c => c[0].Value ^ c[1].Value)
                        .Sum();

            var x = Math.Pow(10, 9) + 7;
            Console.WriteLine(sum % x);
        }

        class Num
        {
            public long Value { get; }
            public int Idx { get; }

            public Num(long n, int idx)
            {
                this.Value = n;
                this.Idx = idx;
            }
        }

        private static IEnumerable<Num[]> EnumerateCombination(IEnumerable<Num> all, int count)
        {
            if (count == 0)
            {
                yield break;
            }
            if (count == 1)
            {
                foreach (var n in all)
                {
                    yield return new[] { n };
                }
                yield break;
            }

            foreach (var n in all)
            {
                var leftside = new[] { n };

                var unused = all.SkipWhile(e => e.Idx != n.Idx).Skip(1).ToList();

                foreach (var rightside in EnumerateCombination(unused, count - 1))
                {
                    yield return leftside.Concat(rightside).ToArray();
                }
            }
        }
    }
}
