#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vvs = vector<vs>;
using vc = vector<char>;
using vvc = vector<vc>;
using vb = vector<bool>;
using vvb = vector<vb>;
bool is_int_lround(double x) { return std::lround(x) == x; }
ll keta(ll x) {
  ll n = 0;
  while (x > 0) {
    x /= 10;
    n++;
  }
  return n;
}
ll conbi(int n, int m) {
  cin >> n >> m;
  vector<ll> a(100);
  a[0] = 1;
  for (int i = 0; i < 14; i++) {
    a[i + 1] = a[i] * (i + 1);
  }
  return a[n] / (a[m] * a[n - m]);
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
ll kaijoMOD(ll x) {
  ll z = 1;
  if (x == 0) {
    return 1;
  }
  while (x > 0) {
    z *= x;
    z %= 1000000007;
    x--;
  }
  return z;
}
ll div_num(ll n) {
  vl div(n + 1, 1);
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      n /= i;
      div[i]++;
    }
  }
  if (n != 1) div[n]++;
  ll num = 1;
  for (ll i = 0; i <= n; i++) {
    num *= div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
int H, W;
vs s(50);
vi dv = {-1, 0, 1, 0};
vi du = {0, -1, 0, 1};
int cnt = 1;
int dfs(int u, int v) {
  s[u][v] = '.';
  ;
  for (int i = 0; i < 4; i++) {
    int nu = u + du[i], nv = v + dv[i];
    if (nu < 0 || nu >= H || nv < 0 || nv >= W) continue;
    if (s[nu][nv] == '.') continue;
    cnt++;
    dfs(nu, nv);
  }
  return cnt;
}
int keta_wa(int x) {
  int tot = 0;
  while (x > 0) {
    tot += x % 10;
    x /= 10;
  }
  return tot;
}
int main() {
  ll N;
  cin >> N;
  vl A(N);
  ;
  for (int i = 0; i < N; i++) cin >> A[i];
  vl nbit(61);
  ;
  for (int i = 0; i < N; i++) {
    int j = 0;
    while (A[i] > 0) {
      if (A[i] % 2 == 1) nbit[j]++;
      A[i] /= 2;
      j++;
    }
  }
  ll ans = 0;
  ll po = 1;
  ;
  for (int i = 0; i < 61; i++) {
    ans += po * nbit[i] * (N - nbit[i]);
    ans %= 1000000007;
    po *= 2;
  }
  cout << ans << endl;
}
