#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000000 + 7;
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;
  long long keta = 1;
  for (long long i = 0; i < 61; i++) {
    int count = 0;
    for (int j = 0; j < (n); j++) {
      if (a[j] & (1 << i)) count++;
    }
    ans += (count * (n - count)) * keta;
    ans %= mod;
    keta *= 2;
    keta %= mod;
  }
  cout << ans << endl;
}
