#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const long long INF = 99999999999999;
const long long MOD = 1000000007;
const long long MAX_N = 400000;
long long n;
long long b0[62], b1[62];
long long a[MAX_N];
void twoadic(long long v) {
  long long b = pow(2, 59);
  for (long long i = 0; i <= 59; i++) {
    if (v / b > 0) {
      b1[59 - i]++;
      v -= b;
    } else
      b0[59 - i]++;
    b /= 2;
  }
}
void solve() {
  for (long long i = 0; i < n; i++) {
    twoadic(a[i]);
  }
  long long ans = 0;
  for (long long i = 0; i < 60; i++) {
    long long pl = pow(2, i) * b0[i];
    pl %= MOD;
    pl *= b1[i];
    pl %= MOD;
    ans += pl;
    ans %= MOD;
  }
  cout << ans << endl;
}
int main() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < 60; i++) {
    b0[i] = 0;
    b1[i] = 0;
  }
  solve();
}
