#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long int;
ll myxor(ll a, ll b) {
  bitset<64> bita = a;
  bitset<64> bitb = b;
  bitset<64> bitc;
  for (int i = 0; i < 64; i++) {
    bitc[i] = bita[i] ^ bitb[i];
  }
  return (bitc.to_ullong());
}
int main() {
  int n;
  cin >> n;
  ll a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  ll count = 0;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      count += myxor(a[i], a[j]);
      if (count > 1000000007) {
        count = count % 1000000007;
      }
    }
  }
  cout << count;
  return 0;
}
