#include <bits/stdc++.h>
using namespace std;
const int inf = 7 + 1e9;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  long long ans = 0, x = 1;
  for (int i = 0; i < 60; ++i) {
    long long cnt = 0;
    for (int j = 0; j < n; ++j) {
      cnt += 1 & (a[j] >> i);
    }
    ans = (ans + x * cnt * (n - cnt)) % inf;
    x <<= 1;
  }
  cout << ans << endl;
}
