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