#include <bits/stdc++.h>
using namespace std;
int64_t bmod(int64_t b, int64_t p) {
  int64_t r = 1;
  while (p > 0) {
    if (p % 2) {
      r = (r * b) % 1000000007;
    }
    p /= 2;
    b = (b * b) % 1000000007;
  }
  return r;
}
int main() {
  int n;
  cin >> n;
  vector<int64_t> freq(64, 0);
  vector<int64_t> sum(64, 0);
  vector<int64_t> ar;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    for (int j = 0; j < 64; j++) {
      freq[j] += (a & (1 << j)) >> j;
    }
    ar.push_back(a);
  }
  for (auto s : ar) {
    for (int j = 0; j < 64; j++) {
      int r = (s & (1 << j)) >> j;
      if (r) {
        sum[j] += n - freq[j];
        freq[j]--;
      } else {
        sum[j] += freq[j];
      }
    }
    n--;
  }
  int64_t ans = 0;
  for (int i = 0; i < 64; i++) {
    ans = (ans + bmod(2, sum[i])) % 1000000007;
  }
  cout << ans;
}
