#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 7;
const int mod = 1e9 + 7;
const double eps = 1e-15;
const double pi = acos(-1);
const int INF = 0x3f3f3f3f;
long long read() {
  long long c = getchar(), Nig = 1, x = 0;
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') Nig = -1, c = getchar();
  while (isdigit(c)) x = ((x << 1) + (x << 3)) + (c ^ '0'), c = getchar();
  return Nig * x;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long a[maxn];
long long qmi(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  long long res = 0;
  for (int i = 60; i >= 0; i--) {
    int l = 0, y = 0;
    for (int j = 1; j <= n; j++) {
      if (a[j] >> i & 1)
        y++;
      else
        l++;
    }
    res = (res + (l * y) * (qmi(2, i)) % mod) % mod;
    res %= mod;
  }
  cout << res % mod << '\n';
  return 0;
}
