#include <bits/stdc++.h>
long long int finv[1000000];
long long int fac[1000000];
long long int inv[1000000];
long long int u(const void *a, const void *b) {
  return *(long long int *)a - *(long long int *)b;
}
long long int d(const void *a, const void *b) {
  return *(long long int *)b - *(long long int *)a;
}
long long int z(long long int a) {
  if (a < 0) return -a;
  return a;
}
long long int min(long long int a, long long int b) {
  if (a > b) return b;
  return a;
}
long long int max(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
long long int gcd(long long int a, long long int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return a * b / gcd(a, b);
}
int kt(long long int a) {
  int sum = 0;
  while (a) {
    a /= 10;
    sum++;
  }
  return sum;
}
int ks(long long int a) {
  int sum = 0;
  while (a) {
    sum += a % 10;
    a /= 10;
  }
  return sum;
}
long long int nCr(int n, int k) {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < 1000000; i++) {
    fac[i] = fac[i - 1] * i % 1000000007;
    inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
    finv[i] = finv[i - 1] * inv[i] % 1000000007;
  }
  return fac[n] * (finv[k] * finv[n - k] % 1000000007) % 1000000007;
}
int main(void) {
  int n;
  scanf("%d", &n);
  long long int a, b[n][60];
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a);
    for (int j = 0; j < 60; j++) {
      b[i][j] = a % 2;
      a /= 2;
    }
  }
  long long int ans = 0;
  for (int i = 0; i < 60; i++) {
    int cnt[2] = {0, 0};
    for (int j = 0; j < n; j++) cnt[b[j][i]]++;
    ans = (ans + cnt[0] * cnt[1] * (long long int)pow(2, i)) % 1000000007;
  }
  printf("%lld\n", ans);
  return 0;
}
