#include <bits/stdc++.h>
using namespace std;
template <int N>
int factorial() {
  return factorial<N - 1>() * N;
}
template <>
int factorial<1>() {
  return 1;
}
int main() {
  priority_queue<int> q;
  string s = {};
  long long h = 0, w = 0, k = 0, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0,
            g = 0, ans = 0;
  long long x[300005] = {};
  long long y[62] = {};
  long long y2[302][302] = {};
  cin >> a;
  for (long long i = 1; i <= a; i++) {
    cin >> x[i];
  }
  for (long long i = 1; i <= a; i++) {
    b = x[i];
    c = 0;
    while (b > 0) {
      if (b % 2 == 1) {
        y[c]++;
      }
      b /= 2;
      c++;
    }
  }
  for (long long i = 0; i <= 60; i++) {
    ans +=
        (y[i] * (a - y[i]) * (long long(pow(2, i)) % 1000000007)) % 1000000007;
    ans = ans % long long(1000000007);
  }
  cout << ans << endl;
  return 0;
}
