using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace D_ABC147
{
    class MainClass
    {

        static long[] nin,s;

        public static void Main(string[] args)
        {
            nin = Array.ConvertAll(ReadLine().Split().ToArray(), long.Parse);
            s = Array.ConvertAll(ReadLine().Split().ToArray(), long.Parse);
            long div = 1000000007;
            long n = nin[0];
            long ans = 0;

            for(int i=0;i<n-1;i++){
                for(int j=i+1;j<n;j++){
                    long tmp = s[i]^s[j];
                    tmp = tmp%div;
                    ans = (ans + tmp)%div;
                }
            }
            WriteLine(ans);
        }
    }
}
