using System;
//using System.Collections.Generic;
using System.IO;
using System.Linq;
//using System.Text;
using static System.Console;
using static LibraryForAtCoder.Lib;

namespace LibraryForAtCoder
{
  static class Lib
  {
    public struct Modular
    {
      const int M = 1000000007;
      readonly long value;
      public Modular(long value) => this.value = value;
      public static implicit operator Modular(long a) => new Modular(a % M);
      public static implicit operator long(Modular a) => a.value;

      public static Modular operator +(Modular a, Modular b) => a.value + b.value;
      public static Modular operator -(Modular a, Modular b) => a.value - b.value;
      public static Modular operator *(Modular a, Modular b) => a.value * b.value;
    }

    public static int ReadI => int.Parse(ReadS);
    public static long ReadL => long.Parse(ReadS);
    public static double ReadD => double.Parse(ReadS);
    public static string ReadS => ReadLine().Trim();

    public static int[] ReadIs => ReadSs.Select(int.Parse).ToArray();
    public static long[] ReadLs => ReadSs.Select(long.Parse).ToArray();
    public static double[] ReadDs => ReadSs.Select(double.Parse).ToArray();
    public static string[] ReadSs => ReadS.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  }

  static class Program
  {
    static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
    static void Print(string a) => sw.WriteLine(a);
    //static void Print<T>(IEnumerable<T> a) => Print(string.Join(" ", a));
    //static void Print<T>(params T[] a) => Print(string.Join(" ", a));
    //static void Print(params object[] a) => Print(string.Join(" ", a));

    static void Main()
    {
      Body();
      sw.Flush();
    }

    static void Body()
    {
      var N = ReadL;
      var A = ReadLs;
      Modular sum = 0;
      for (int i = 0; i < N - 1; i++)
      {
        for (int j = i + 1; j < N; j++)
        {
          sum += A[i] ^ A[j];
        }
      }
      Print($"{sum}");
    }
  }
}
