#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long modpow(long long x, long long y, long long p = mod) {
  long long res = 1;
  x %= p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y >>= 1;
    x = (x * x) % p;
  }
  return res;
}
long long add(long long x, long long y) { return (x + y) % mod; }
long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) return x + mod;
  return x;
}
long long inv(long long a, long long m = mod) { return modpow(a, m - 2, m); }
long long mul(long long a, long long b) { return (long long)a * b % mod; }
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(9);
  long long n;
  cin >> n;
  vector<long long> a(n + 10);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  long long ans = 0;
  for (long long i = 0; i < 62; ++i) {
    vector<long long> cnt = {0, 0};
    for (long long j = 0; j < n; ++j) {
      ++cnt[(a[j] & (1LL << i)) != 0];
    }
    ans = add(ans, mul(cnt[0], mul(cnt[1], (1LL << i))));
  }
  cout << ans << '\n';
}
