#include <bits/stdc++.h>
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
using namespace std;
long long ttt = 1;
long long n, a, b[65], ans;
void solve() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    for (long long j = 0, p = 1; j <= 60; j++, p *= 2)
      if (a & p) b[j]++;
  }
  for (long long i = 0, p = 1; i < 61; i++, p *= 2)
    ans = (ans + ((b[i] * (n - b[i]) * p) % 1000000007)) % 1000000007;
  cout << ans;
}
int main() {
  for (int i = 0; i < ttt; i++) solve();
}
