#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(60, 0);
  for (long long i = (0); i < ((n)); ++i) {
    long long x;
    cin >> x;
    for (long long j = (0); j < ((60)); ++j)
      if (x & (1LL << j)) a[j]++;
  }
  long long ans = 0;
  for (long long j = (0); j < ((60)); ++j) {
    long long base = (1LL << j);
    base %= 1000000007;
    ans += a[j] * (n - a[j]) * base;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
