#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
const long long MOD = 1000000007;
long long m_add(long long a, long long b) { return (a + b) % MOD; }
long long m_sub(long long a, long long b) { return (a + MOD - b) % MOD; }
long long m_mul(long long a, long long b) { return (a * b) % MOD; }
long long m_pow(long long x, long long n) {
  if (n == 0) return 1;
  ll res = m_pow((x * x) % MOD, n / 2);
  if (n & 1) res = (res * x) % MOD;
  return res;
}
long long m_divide(long long a, long long b) {
  return m_mul(a, m_pow(b, MOD - 2));
}
long long m_comb(long long n, long long r) {
  long long i;
  long long p = 1;
  for (i = 1; i <= r; i++) {
    p = m_mul(p, (n - i + 1));
    p = m_divide(p, i);
  }
  return p;
}
long long m_comb_with_rep(long long n, long long r) {
  return m_comb(n + r - 1, r);
}
long long N;
long long A[300010];
signed main() {
  cin >> N;
  for (long long(i) = 0; (i) < (N); (i)++) cin >> A[i];
  long long ans = 0;
  for (long long i = 0; i < 60; i++) {
    long long n0 = 0;
    long long n1 = 0;
    for (long long j = 0; j < N; j++) {
      if ((A[j] & (1LL << i)) == 0)
        n0++;
      else
        n1++;
    }
    long long s = m_mul(n0, n1);
    long long a = m_mul((1LL << i), s);
    ans = m_add(ans, a);
  }
  cout << ans << endl;
}
