#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int one[64];
int main() {
  int N;
  cin >> N;
  vector<ll> a(N);
  for (int i = 0; i < (N); i++) cin >> a[i];
  for (int i = 0; i < (N); i++) {
    for (int j = 0; j < (60); j++) {
      if (a[i] >> j & 1) one[j]++;
    }
  }
  ll ans = 0;
  for (int i = 0; i < (60); i++) {
    int x = 0;
    for (int j = 0; j < (N); j++) {
      if (a[j] >> i & 1) x++;
    }
    ll temp = x * (N - x) % 1000000007;
    for (int j = 0; j < (i); j++) temp = temp * 2 % 1000000007;
    ans += temp;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
