#include <bits/stdc++.h>
using namespace std;
void showVector(vector<int> v) {
  for (vector<int>::iterator itr = v.begin(); itr != v.end(); ++itr) {
    cout << *itr;
  }
  cout << endl;
}
void showVectors(vector<vector<int> > v2) {
  for (vector<vector<int> >::iterator itr = v2.begin(); itr != v2.end();
       ++itr) {
    showVector(*itr);
  }
}
vector<int> getBit(unsigned long num) {
  unsigned long decimal = num;
  vector<int> binary;
  for (int i = 0; decimal > 0; i++) {
    binary.insert(binary.begin(), decimal % 2);
    decimal = decimal / 2;
  }
  return binary;
}
int getDecimal(vector<int> v) {
  int ret = 0;
  vector<int>::iterator itr = v.begin();
  for (int i = v.size() - 1; i >= 0; --i) {
    ret += *itr * pow(2, i);
    ++itr;
  }
  return ret;
}
vector<int> getXOR(vector<int> X, vector<int> Y) {
  if (X.size() < Y.size()) {
    vector<int>::iterator itr = X.begin();
    itr = X.insert(itr, 0);
  } else if (X.size() > Y.size()) {
    vector<int>::iterator itr = Y.begin();
    itr = Y.insert(itr, 0);
  }
  vector<int> result;
  vector<int>::iterator yitr = Y.begin();
  for (vector<int>::iterator xitr = X.begin(); xitr != X.end(); ++xitr) {
    if (*xitr == *yitr) {
      result.push_back(0);
    } else {
      result.push_back(1);
    }
    ++yitr;
  }
  return result;
}
int main() {
  int N;
  cin >> N;
  unsigned long A[N];
  vector<vector<int> > As;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
    As.push_back(getBit(A[i]));
  }
  int ret = 0;
  for (vector<vector<int> >::iterator i = As.begin(); i != As.end(); ++i) {
    for (vector<vector<int> >::iterator j = i + 1; j != As.end(); ++j) {
      ret += getDecimal(getXOR(*i, *j));
    }
  }
  unsigned long div = 1000000007;
  cout << ret % div << endl;
  return 0;
}
