#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; ++i) cin >> a[i];
  long long maxi = *max_element(a.begin(), a.end());
  long long now = 1;
  long long ans = 0;
  while (now <= maxi) {
    long long count = 0;
    for (long long i = 0; i < n; ++i)
      if (a[i] & now) count++;
    ans = (ans + (n - count) * count * now % 1000000007) % 1000000007;
    now <<= 1;
  }
  cout << ans << endl;
}
