#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (long long i = 60; i >= 0; i--) {
    long long o = 0, z = 0;
    for (long long j = 0; j < n; j++) {
      if ((a[j] >> i) & 1)
        o++;
      else {
        z++;
      }
    }
    ans += (o * z) * (pow(2, i));
    ans %= (1000000007);
  }
  cout << ans << endl;
  return 0;
}
