#include <bits/stdc++.h>
using namespace std;
vector<int64_t> bit(int64_t a) {
  vector<int64_t> res(61);
  for (int i = 0; i < res.size(); i++) {
    if (a % 2 == 1) {
      res.at(i) = 1;
    }
    a /= 2;
  }
  return res;
}
int64_t tib(vector<int64_t> a) {
  int64_t res = 0;
  int64_t po = 1;
  for (int i = 0; i < a.size(); i++) {
    res += po * a.at(i);
    po *= 2;
  }
  return res;
}
int64_t XOR(int64_t a, int64_t b, int64_t m) {
  vector<int64_t> A = bit(a);
  vector<int64_t> B = bit(b);
  vector<int64_t> res(A.size());
  for (int i = 0; i < A.size(); i++) {
    if (A.at(i) + B.at(i) == 1) {
      res.at(i) = 1;
    } else {
      res.at(i) = 0;
    }
  }
  return tib(res) % m;
}
int main() {
  int64_t N;
  cin >> N;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  int64_t m = pow(10, 9) + 7;
  int64_t sum = 0;
  for (int i = 1; i <= N - 1; i++) {
    for (int j = i + 1; j <= N; j++) {
      sum += XOR(A.at(i - 1), A.at(j - 1), m);
      sum %= m;
    }
  }
  cout << sum << endl;
}
