#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
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 < 63; ++i) {
    int x = 0;
    for (int j = 0; j < n; ++j) {
      if (a[j] & (1LL << i)) ++x;
    }
    ans += (1LL << i) * x * (n - x);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
