#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;
const double PI = acos(-1.0);
const long long MOD = 1e9 + 7;
long long cnt1 = 0, cnt0 = 0;
void func() {
  long long a = 1;
  for (int i = 0; i < 60; i++) {
    a *= 2;
  }
  cout << a << endl;
}
bitset<60> changebit(long long a) {
  int i = 0;
  bitset<60> b;
  while (a > 0) {
    b[i] = a % 2;
    i++;
    a /= 2;
  }
  return b;
}
long long pow_kai(long long a, long long n) {
  long long x = 1;
  while (n > 0) {
    if (n & 1) {
      x = x * a;
    }
    a = a * a;
    n >>= 1;
  }
  return x;
}
long long changenum(bitset<60> b) {
  long long a = 0;
  for (int i = 0; i < 60; i++) {
    a += b[i] * pow_kai(2, i);
  }
  return a;
}
bitset<60> x0r(bitset<60> a, bitset<60> b) {
  bitset<60> d;
  for (int i = 0; i < 60; i++) {
    if ((a[i] == 0 && b[i] == 1) || (a[i] == 1 && b[i] == 0)) {
      d[i] = 1;
    } else {
      d[i] = 0;
    }
  }
  return d;
}
void counting(bitset<60> a) {
  for (int i = 0; i < 60; i++) {
    if (a[i] == 0) {
      cnt0++;
    } else {
      cnt1++;
    }
  }
  return;
}
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<bitset<60>> a(n);
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    bitset<60> y(x);
    a[i] = y;
  }
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    long long p = 0, q = 0;
    for (int j = 0; j < n; j++) {
      if (a[j][i] == 1)
        p++;
      else
        q++;
    }
    ans += (((p * q) % MOD) * modpow(2, i)) % MOD;
  }
  cout << ans << endl;
}
