#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int N = 1e6 + 6;
long long powmod(long long a, long long b, long long mod) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
  }
  return res;
}
long long gcd(long long a, long long b) {
  while (b > 0) {
    long long t = a % b;
    a = b, b = t;
  }
  return a;
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long is_prime(long long n) {
  if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0)) return 0;
  for (long long i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
    if (n % i == 0) return 0;
  return 1;
}
long long bit[1000005], a[1000005];
long long N1 = 200005;
void update(int x, int del) {
  for (; x <= N1; x += x & -x) {
    bit[x] += del;
  }
}
int query(int x) {
  int sum = 0;
  for (; x > 0; x -= x & -x) {
    sum += bit[x];
  }
  return sum;
}
int main() {
  long long n;
  cin >> n;
  long long a[n];
  long long b[64] = {0};
  long long c[64] = {0};
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < 64; i++) {
    for (int j = 0; j < n; j++) {
      if ((a[j] & (1LL << i)) >= 1)
        b[i]++;
      else
        c[i]++;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 64; i++) ans += ((1 << i) * (b[i] * c[i])) % MOD;
  cout << ans % MOD << "\n";
  return 0;
}
