#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<long long> a(n), o(61, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<int> > a2(n, vector<int>(61, 0));
  for (int i = 0; i < n; i++) {
    long long x = a[i];
    int j = 0;
    while (x != 0) {
      a2[i][j] = x % 2;
      o[j] += x % 2;
      x /= 2;
      j++;
    }
  }
  long long ans = 0;
  for (int k = 0; k < 61; k++) {
    long long x =
        (o[k] * (n - o[k]) * ((long long)pow(2, k) % 1000000007)) % 1000000007;
    ans = (ans + x) % 1000000007;
  }
  cout << ans << endl;
  return;
}
int main() {
  solve();
  return 0;
}
