#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const long long mod = pow(10, 9) + 7;
const long long INF = pow(2, 31) - 1;
using str = string;
long long gcd(long long a, long long b) {
  long long v0 = a, v1 = b, v2 = a % b;
  while (v2 != 0) {
    v0 = v1;
    v1 = v2;
    v2 = v0 % v1;
  }
  return v1;
}
long long lcm(long long a, long long b) { return (a * b / gcd(a, b)); }
const int MAX_N = 300005;
int myXOR(int x, int y) {
  int res = 0;
  for (int i = 31; i >= 0; i--) {
    bool b1 = x & (1 << i);
    bool b2 = y & (1 << i);
    bool xoredBit = (b1 & b2) ? 0 : (b1 | b2);
    res <<= 1;
    res |= xoredBit;
  }
  return res;
}
int main() {
  int n;
  int a[MAX_N + 1];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      ans += myXOR(a[i], a[j]);
    }
  }
  cout << ans % mod << endl;
  return 0;
}
