#include <bits/stdc++.h>
using namespace std;
int n;
vector<int64_t> arr;
int64_t dp[65];
int64_t ans[128];
const int64_t mod = 1e9 + 7;
int64_t fans = 0;
int main() {
  for (int i = 0; i < 64; ++i) dp[i] = 0;
  for (int j = 0; j < 128; ++j) ans[j] = 0;
  cin >> n;
  arr.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; ++i) {
    long long tmp = arr[i];
    int pos = 0;
    while (tmp) {
      if (tmp & 1LL) {
        dp[pos]++;
      }
      pos++;
      tmp >>= 1;
    }
  }
  for (int i = 0; i < 64; ++i) {
    ans[i] += dp[i] * (n - dp[i]);
    int64_t tmp = ans[i];
    ans[i] = 0;
    for (int j = 0; j < 64; ++j) {
      if (tmp & 1LL << j) {
        ans[i + j] += 1;
      }
    }
  }
  long long po2 = 1;
  assert(fans == 0);
  for (int i = 0; i < 128; ++i) {
    if (ans[i]) {
      fans += po2;
      fans %= mod;
    }
    po2 *= 2LL;
    po2 %= mod;
  }
  cout << fans << "\n";
  return 0;
}
