#include <bits/stdc++.h>
using namespace std;
bool prime(long long n) {
  for (long long i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) return false;
  }
  return n != 1;
}
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
long long mod_pow(long long n, long long p, long long m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    long long t = mod_pow(n, p / 2, m);
    return (t * t) % m;
  }
  return n * mod_pow(n, p - 1, m) % m;
}
long long extGCD(long long a, long long b, long long& x, long long& y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long d = extGCD(b, a % b, y, x);
  y -= a / b * x;
  return d;
}
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
long long digit(long long x) {
  long long cnt = 0;
  while (x > 0) {
    cnt += x % 10;
    x /= 10;
  }
  return cnt;
}
long long bit[300005][64];
signed main() {
  long long n, ans = 0;
  cin >> n;
  long long a[300005], b[300005];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
    long long now = 0;
    while (a[i] > 0) {
      bit[i][now] = a[i] % 2;
      a[i] /= 2;
      now++;
    }
  }
  long long bou = 1;
  for (long long i = 0; i < 61; i++) {
    long long zero = 0, one = 0;
    for (long long j = 0; j < n; j++) {
      if (bit[j][i])
        one++;
      else
        zero++;
    }
    ans += bou * (one * zero);
    ans %= 1000000007;
    bou *= 2;
    bou %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
