#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const long long LINF = 1LL << 60;
const long long MOD = (long long)1e9 + 7;
long long mod_pow(long long x_, long long y_) {
  if (y_ == 0) return 1;
  long long res = mod_pow(x_ * x_ % MOD, y_ / 2);
  if (y_ & 1) res = x_ * res % MOD;
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<long long int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long int> p(60);
  for (int i = 0; i < 60; i++) {
    long long int x = 0, y = 0;
    for (int j = 0; j < n; j++) {
      if (((a[j] >> i) & 1) == 1) {
        x++;
      } else {
        y++;
      }
    }
    p[i] = x * y;
  }
  long long int ans = 0, d = 1;
  for (int i = 0; i < 60; i++) {
    ans += d * p[i];
    ans %= MOD;
    d *= 2;
    d %= MOD;
  }
  cout << ans << endl;
  return 0;
}
