#include <bits/stdc++.h>
using namespace std;
long long xorsum(long long a, long long b, long long p) {
  long long memo1 = -1, memo2 = -1, x = 1;
  while (memo1 == -1 || memo2 == -1) {
    if (x > a) memo1 = x / 2;
    if (x > b) memo2 = x / 2;
    x *= 2;
  }
  long long memo = max(memo1, memo2);
  vector<int> s1(0), s2(0);
  for (int i = memo; i > 0; i /= 2) {
    s1.push_back(a / i);
    a %= i;
    s2.push_back(b / i);
    b %= i;
  }
  string ans;
  for (long long i = 0; i < s1.size(); i++) {
    if (s1.at(i) != s2.at(i))
      ans.push_back('1');
    else
      ans.push_back('0');
  }
  long long last = 0;
  for (long long i = 0; i < ans.size(); i++) {
    last += (ans.at(i) - '0') * pow(2, ans.size() - 1 - i);
    last %= p;
  }
  return last;
}
int main() {
  long long n, p = 1000000007;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a.at(i);
  long long sum = 0;
  for (long long i = 0; i < n - 1; i++) {
    for (long long j = i + 1; j < n; j++) {
      sum += xorsum(a.at(i), a.at(j), p);
      sum %= p;
    }
  }
  cout << sum << endl;
}
