using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        //MyDebugger.MakeTestCase("../TextFile2.txt"); return;
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static long mod = 1000000007;

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var aa = toArray(input.ReadLine(), n);

        var sum = 0L;
        for (int i = 0; i < n-1; i++) {
            for (int j = i + 1; j < n; j++) {
                sum += aa[i] ^ aa[j];
                sum %= mod;
            }
        }

        return sum % mod;
    }

    static long[] toArray(string s, int n) {
        var ret = new long[n];
        int i=0;
        foreach (var ss in s.Split(' ')) {
            ret[i] = long.Parse(ss);
            i++;
        }
        return ret;
    }
}
