#include <bits/stdc++.h>
using namespace std;
const int vx[4] = {0, 1, 0, -1};
const int vy[4] = {1, 0, -1, 0};
unsigned long long Madd(unsigned long long x, unsigned long long y) {
  return (x + y) % (unsigned long long)(1e9 + 7);
}
unsigned long long Msub(unsigned long long x, unsigned long long y) {
  return (x - y + (unsigned long long)(1e9 + 7)) %
         (unsigned long long)(1e9 + 7);
}
unsigned long long Mmul(unsigned long long x, unsigned long long y) {
  return (x * y) % (unsigned long long)(1e9 + 7);
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  unsigned long long n;
  cin >> n;
  vector<unsigned long long> a(n);
  for (unsigned long long i = (unsigned long long)0; i < (unsigned long long)n;
       i++) {
    cin >> a[i];
  }
  unsigned long long ans = 0;
  unsigned long long u = 1;
  for (unsigned long long i = (unsigned long long)0; i < (unsigned long long)70;
       i++) {
    unsigned long long s = 0, t = 0;
    for (unsigned long long j = (unsigned long long)0;
         j < (unsigned long long)n; j++) {
      if (a[j] & u)
        s++;
      else
        t++;
    }
    ans = Madd(ans, Mmul(u, Mmul(s, t)));
    u *= 2;
  }
  cout << ans << endl;
}
