using System;
using System.Collections.Generic;
public class ABC147D {
    public static void Main() {
        long MOD = 1000000007;
        long N, ans = 0;
        List<long> A = new List<long>();
        N = long.Parse(Console.ReadLine());
        string[] str = Console.ReadLine().Split(' ');
        for (int i = 0; i < N; i++) {
            A.Add(long.Parse(str[i]));
        }

        for (int i = 0; i < N - 1; i++) {
            long a = A[i];
            for (int j = i + 1; j < N; j++) {
                long b = A[j];
                ans += (a ^ b) % MOD;
                ans %= MOD;
            }
        }
        Console.WriteLine(ans);
    }
}