import java.io.*;
import java.util.*;

public class Main{
    static MyReader in = new MyReader();
    static PrintWriter out = new PrintWriter(System.out);
    static long M = 1000000007;

    public static void main(String[] args){
        int N = in.i();
        long[] A = in.ll();
        long ans = 0;
        
        for(int i = 0; i < 60; i++){
            long b = 1L<<i;
            int count = 0;
            for(int j = 0; j < N; j++){
                long c = A[j] & b;
                if(c != 0) count++;
            }
            ans = (ans+f(b%M, count, N-count))%M;
        }
        out.println(ans);
        out.flush();
    }
    
    static int f(long... a){
        long b = 1;
        for(int i = 0; i < a.length; i++){
            b = (b*a[i])%M;
        }
        return (int)b;
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        ArrayList<Integer> li(){
            String[] ss = ss();
            ArrayList<Integer> li = new ArrayList<>();
            for(int j = 0; j < ss.length; j++) li.add(Integer.parseInt(ss[j]));
            return li;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}
