#include <bits/stdc++.h>
const long double PI = acos(-1.0);
using namespace std;
int n;
int cnt[66];
long long m[66];
int main() {
  m[0] = 1;
  for (int i = 1; i <= 60; i++) {
    m[i] = 2 * m[i - 1];
    m[i] %= 1000000007;
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long x;
    scanf("%lld", &x);
    for (int j = 0; j < 60; j++) {
      if (x & (1ll << j)) cnt[j]++;
    }
  }
  long long amid = 0;
  for (int i = 0; i < 60; i++) {
    long long _1 = cnt[i];
    long long _0 = n - cnt[i];
    long long x = (1ll << i);
    amid += ((_1 * _0) % 1000000007 * x);
    amid %= 1000000007;
  }
  cout << amid << '\n';
}
