#include <bits/stdc++.h>
using namespace std;
string f(long int x, long int y) {
  string s, t;
  while (x > 0 || y > 0) {
    if (x != 0) s += char(x % 2 - '0');
    if (y != 0) t += char(y % 2 - '0');
    x /= 2;
    y /= 2;
  }
  if (t.size() > s.size()) {
    string v = t;
    t = s;
    s = v;
  }
  for (int i = 0; i < t.size(); ++i) {
    if (t[i] != s[i])
      s[i] = '1';
    else
      s[i] = '0';
  }
  for (int i = t.size(); i < s.size(); ++i) s[i] = '1';
  return s;
}
long int g(string s) {
  long int x = 0;
  for (int i = 0; i < s.size(); ++i) {
    x += (s[i] - '0') * pow(2, i);
  }
  return x;
}
int main() {
  long int ans = 0, n;
  cin >> n;
  const int N = 3 * pow(10, 5);
  long int x[N];
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      ans += g(f(x[i], x[j])) % int(pow(10, 9) + 7);
      ans %= int(pow(10, 9) + 7);
    }
  }
  cout << ans << endl;
}
