#include <bits/stdc++.h>
using namespace std;
long long powM(long long a, long long b, long long m) {
  a %= m;
  long long ans = 1;
  while (b > 0) {
    if (b & 1) ans = ans * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return ans;
}
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long p = 1e9 + 7;
  long long ans = 0, mxn = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long pos = 0; pos < 61; pos++) {
    long long c = 0, d = 0;
    for (long long i = 0; i < n; i++) {
      if (a[i] & 1)
        c++;
      else
        d++;
      a[i] >>= 1;
    }
    ans += (1LL << pos) * (c * d % p);
    ans %= p;
  }
  cout << ans << "\n";
  return 0;
}
