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

class AtCoder {
  public static void Main() {
    int N = int.Parse(Console.ReadLine().Trim());
    //var l = Console.ReadLine().Trim().Split(' ').Select(x => new Modular(long.Parse(x))).ToList();
    var l = Console.ReadLine().Trim().Split(' ').Select(x => long.Parse(x)).ToList();
	int denominator = 1000000000 + 7;
    
    Modular sum = new Modular(0);
    long sum2 = 0;
    
    for(var i = 0; i < N - 1; i++) {
      for(var j = i + 1; j < N; j++) {
        // 1 + 2 = 01 + 10 = 11 = 3
        // 1 + 3 = 01 + 11 = 10 = 2
        // 2 + 3 = 10 + 11 = 01 = 1
        //sum = sum + new Modular((long)((byte)l[i] ^ (byte)l[j]));
        sum = new Modular((long)sum + (long)((byte)l[i] ^ (byte)l[j]));
        //sum2 = sum2 + (long)((byte)l[i] ^ (byte)l[j]);

        //Console.WriteLine((long)sum);
      }
    }
    //byte a = 201 ^ 92;
    //Console.WriteLine(a);
    //Console.WriteLine(string.Join(" ", l));
    Console.WriteLine((long)sum);
    //Console.WriteLine(sum2 % denominator);
  }
}



class Modular
{
    private const int M = 1000000007;
    private long value;
    public Modular(long value) { this.value = value; }
    public static implicit operator Modular(long a)
    {
        var m = a % M;
        return new Modular((m < 0) ? m + M : m);
    }
    public static Modular operator +(Modular a, Modular b)
    {
        return a.value + b.value;
    }
    public static Modular operator -(Modular a, Modular b)
    {
        return a.value - b.value;
    }
    public static Modular operator *(Modular a, Modular b)
    {
        return a.value * b.value;
    }
    private static Modular Pow(Modular a, int n)
    {
        switch (n)
        {
        case 0:
            return 1;
        case 1:
            return a;
        default:
            var p = Pow(a, n / 2);
            return p * p * Pow(a, n % 2);
        }
    }
    public static Modular operator /(Modular a, Modular b)
    {
        return a * Pow(b, M - 2);
    }
    private static readonly List<int> facs = new List<int> { 1 };
    private static Modular Fac(int n)
    {
        for (int i = facs.Count; i <= n; ++i)
        {
            facs.Add((int)(Math.BigMul(facs.Last(), i) % M));
        }
        return facs[n];
    }
    public static Modular Ncr(int n, int r)
    {
        return (n < r)  ? 0
             : (n == r) ? 1
                        : Fac(n) / (Fac(r) * Fac(n - r));
    }
    public static explicit operator int(Modular a)
    {
        return (int)a.value;
    }
    public static explicit operator long(Modular a)
    {
        return (long)a.value;
    }
}