#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long myXOR(long long x, long long y) { return (x | y) & (~x | ~y); }
int main() {
  long long z, n, sum = 0;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  for (long long i = 0; i < n - 1; i++) {
    for (long long j = i + 1; j < n; j++) {
      z = myXOR(v[i], v[j]);
      sum = ((sum % mod) + (z % mod)) % mod;
    }
  }
  cout << sum << endl;
  return 0;
}
