#include <bits/stdc++.h>
const double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
using namespace std;
long long ModExp(long long x, long long y, long long m) {
  long long res = 1;
  x = x % m;
  while (y > 0) {
    if (y & 1) res = (res * x) % m;
    y = y >> 1;
    x = (x * x) % m;
  }
  return res;
}
long long fans(long long arr[], long long n) {
  long long sum = 0;
  for (long long i = 0; i < 61; i++) {
    long long zc = 0, oc = 0;
    long long idsum = 0;
    for (long long j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = oc * zc * ModExp(2, i, 1000000007);
    idsum %= 1000000007;
    sum += idsum;
    sum %= 1000000007;
  }
  return sum;
}
void solve() {
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  cout << fans(arr, n) << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  while (t--) {
    solve();
  }
}
