using System;
using System.Linq;

namespace ABC147D {
    class Program {
        static void Main(string[] args) {
            Console.ReadLine();
            var aArray = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            var n = 0L;
            var length = aArray.Length;
            for (var i = 0; i < length - 1; i++) {
                var l = aArray[i];
                for (var j = i + 1; j < length; j++) {
                    var r = aArray[j];
                    var x = l ^ r;
                    n += x;
                    while (n > 1000000007) n -= 1000000007;
                }
            }

            Console.WriteLine(n);
        }
    }
}