#include <bits/stdc++.h>
using namespace std;
const long long prime = 1000000000 + 7;
const long double PI = 2 * acos(0.0);
bool my_comp(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.first != b.first) {
    return a.first < b.first;
  }
  return a.second < b.second;
}
long long power(long long n, long long k) {
  long long p = 1000000000 + 7;
  if (k == 1) {
    return n;
  }
  long long m = n * n;
  m %= p;
  if (k % 2 == 0) {
    return power(m, k / 2);
  }
  m = power(m, k / 2);
  m *= n;
  m %= p;
  return m;
}
long long com(long long n, long long k) {
  long long p = 1000000000 + 7;
  long long ans = 1;
  for (long long i = 1; i <= n; i++) {
    ans *= i;
    ans %= p;
  }
  for (long long i = 2; i <= k; i++) {
    ans *= power(i, p - 2);
    ans %= p;
  }
  for (long long i = 2; i <= n - k; i++) {
    ans *= power(i, p - 2);
    ans %= p;
  }
  return ans;
}
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long> keta(60);
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < 60; j++) {
      keta[j] += a[i] % 2;
      a[i] /= 2;
    }
  }
  long long e;
  long long sum = 0;
  long long d;
  for (long long i = 0; i < 60; i++) {
    long long k = keta[i];
    e = (long long)1 << i;
    e %= prime;
    d = e * k * (n - k);
    d %= prime;
    sum += d;
    sum %= prime;
  }
  cout << sum << endl;
  return 0;
}
