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 static long GCD(long a, long b)
    {
      if (a < b) (a, b) = (b, a);
      var r = a % b;
      while (r != 0)
      {
        a = b;
        b = r;
        r = a % b;
      }
      return b;
    }

    public static long LCM(long left, long right) => left / GCD(left, right) * right;

    public readonly 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 Modular operator /(Modular a, Modular b) => a * Pow(b, M - 2);
      public static Modular Pow(Modular b, int e)
      {
        if (e == 0 || b == 1) return 1;
        if (b == 0) return 0;
        Modular result = 1;
        while (e > 1)
        {
          if ((e & 1) == 1)
          {
            result *= b;
            e--;
          }
          b *= b;
          e >>= 1;
        }
        return result * b;
      }
      public static Modular Fact(long n)
      {
        if (n < 0) throw new ArgumentException($"n = {n} が非負整数でない");
        Modular result = 1;
        for (var i = 1; i <= n; i++) result *= i;
        return result;
      }
      // 重複を許す場合 n^r
      public static Modular P(int n, int r) =>
        (n < r) ? throw new ArgumentException("n < r")
        : Fact(n) / Fact(n - r);

      // 重複を許す場合 n+r-1Cr
      public static Modular C(int n, int r) =>
        (n < r) ? throw new ArgumentException("n < r")
        : (n == r) ? 1
        : P(n, r) / Fact(r);

      public static long Sum(long[] vector)
      {
        long sum = 0;
        foreach (var fraction in vector) sum += fraction;
        return sum;
      }

      public static long Sum(long[][] vector)
      {
        long sum = 0;
        foreach (var fraction in vector) sum += Sum(fraction);
        return sum;
      }
    }

    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;
      long sum = 0;
      for (int i = 0; i < N - 1; i++)
      {
        for (int j = i + 1; j < N; j++)
        {
          sum += A[i] ^ A[j] % 1000000007;
        }
      }
      Print($"{sum}");
    }
  }
}