#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  long long ans = 0;
  for (int i = 0; i < 60; ++i) {
    int one = 0;
    for (int j = 0; j < n; ++j) {
      if ((a[j] >> i) & 1) {
        one++;
      }
    }
    int zero = n - one;
    long long two = (1ll << i) % 1000000007;
    long long res = (one * zero) % 1000000007;
    res = (res * two) % 1000000007;
    ans = (ans + res) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
