#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  long long res = 0;
  long long mod = 1e9 + 7;
  for (int i = 0; i < 60; ++i) {
    if (i == 59) {
    }
    long long sum0 = 0;
    long long sum1 = 0;
    for (int j = 0; j < n; ++j) {
      if (a[j] & (1LL << i)) {
        sum1++;
      } else {
        sum0++;
      }
    }
    long long mul = (1LL << i) % mod;
    res += sum0 * sum1 * mul;
    res %= mod;
  }
  cout << res << endl;
}
