#include <bits/stdc++.h>
using namespace std;
long long A = (long long)pow(2, 59), x, A2, ans = 0;
long long Xor(long long a, long long b) {
  int c, d;
  x = 0;
  A2 = A;
  for (int i = 0; i < (60); ++i) {
    c = d = 0;
    if (a >= A2) {
      c = 1;
      a -= A2;
    }
    if (b >= A2) {
      d = 1;
      b -= A2;
    }
    if (c + d == 1) x = (x + (long long)pow(2, 59 - i)) % 1000000007;
    A2 /= 2;
  }
  return x;
}
int main() {
  int n;
  cin >> n;
  long long D[300005];
  for (int i = 0; i < (n); ++i) cin >> D[i];
  for (int i = 0; i < (n - 1); ++i) {
    for (int j = (i + 1); j < (n); ++j)
      ans = (ans + Xor(D[i], D[j])) % 1000000007;
  }
  cout << ans << endl;
}
