import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long[] A = new long[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextLong();
    }
    sc.close();
    
    long ans = 0;
    for (int i = 0; i < N; i++) for (int j = i + 1; j < N; j++)
        ans += A[i] ^ A[j];
	ans %= 1000000007;
    System.out.println(ans);
  }
}
