#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long my_pow(long long a, long long p) {
  if (p == 0) return 1;
  if (p % 2 == 1) {
    long long t = my_pow(a, p - 1);
    return t * a % MOD;
  } else {
    long long t = my_pow(a, p / 2);
    return t * t % MOD;
  }
}
int main() {
  long long N;
  cin >> N;
  string *s = new string[N];
  for (int i = 0; i < N; i++) {
    long long A;
    cin >> A;
    for (int j = 0; j < 60; j++) {
      s[i].push_back(A % 2 + '0');
      A /= 2;
    }
  }
  long long **cnt_1 = new long long *[N], **cnt_0 = new long long *[N];
  for (int i = 0; i < N; i++) {
    cnt_1[i] = new long long[60];
    cnt_0[i] = new long long[60];
    for (int j = 0; j < 60; j++) cnt_0[i][j] = 0, cnt_1[i][j] = 0;
  }
  for (long long i = 0; i < 60; i++) {
    for (long long j = 1; j < N; j++) {
      if (s[j][i] == '0') {
        cnt_0[j][i] = cnt_0[j - 1][i] + 1;
        cnt_1[j][i] = cnt_1[j - 1][i];
      } else {
        cnt_0[j][i] = cnt_0[j - 1][i];
        cnt_1[j][i] = cnt_1[j - 1][i] + 1;
      }
    }
  }
  long long p_2 = 1;
  long long ans = 0;
  for (long long k = 0; k < 60; k++) {
    for (long long i = 0; i < N - 1; i++) {
      long long x;
      if (s[i][k] == '1')
        x = cnt_0[N - 1][k] - cnt_0[i][k];
      else
        x = cnt_1[N - 1][k] - cnt_1[i][k];
      ans += p_2 * x % MOD;
    }
    p_2 *= 2;
  }
  cout << ans % MOD << endl;
  return 0;
}
