#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;
int main() {
  ll MOD = 1000000007;
  ll n;
  cin >> n;
  vll a(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  vll count1(100, 0);
  vll sum(100);
  for (ll i = 0; i < n; i++) {
    vll shinsu(0);
    while (a[i] > 1) {
      shinsu.emplace_back(a[i] % 2);
      a[i] /= 2;
    }
    shinsu.emplace_back(1);
    for (ll j = 0; j < shinsu.size(); j++) {
      if (shinsu[j] == 1) {
        count1[j]++;
      }
    }
  }
  ll ans = 0;
  for (ll i = 0; i < 100; i++) {
    sum[i] = count1[i] * (n - count1[i]);
    ans += sum[i] * pow(2, i);
    ans %= MOD;
  }
  cout << ans << endl;
}
