#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7, MAX = 1e5 + 5;
long long powN(long long a, long long p, long long b) {
  if (p == 0) return 1;
  long long z = powN(a, p / 2, b);
  z = (z * z) % b;
  if (p % 2) z = (z * a) % b;
  return z;
}
vector<bool> is_prime(MAX + 1, true);
void Sieve() {
  is_prime[0] = is_prime[1] = false;
  int i, j;
  for (i = 2; i * i <= MAX; i++) {
    if (is_prime[i]) {
      for (j = i * i; j <= MAX; j += i) is_prime[j] = false;
    }
  }
}
long long modInv(long long a) { return powN(a, MOD - 2, MOD); }
int main() {
  int n;
  cin >> n;
  vector<vector<int>> V(n, vector<int>(60));
  for (int i = 0; i < n; i++) {
    long long int a;
    cin >> a;
    for (int j = 0; j < 60; j++) {
      V[i][59 - j] = a % 2;
      a /= 2;
    }
  }
  vector<vector<int>> VV(n, vector<int>(60));
  for (int j = 0; j < 60; j++) {
    if (V[0][j] == 1) VV[0][j] = 1;
    for (int i = 1; i < n; i++) {
      if (V[i][j] == 1)
        VV[i][j] = VV[i - 1][j] + 1;
      else
        VV[i][j] = VV[i - 1][j];
    }
  }
  long long int sum = 0;
  for (int i = 0; i < 60; i++) {
    long long int x = 0;
    for (int j = 1; j < n; j++) {
      if (V[j][i] == 1)
        x += j - VV[j - 1][i];
      else
        x += VV[j - 1][i];
    }
    long long int aa = 2;
    for (int j = 0; j < x; j++) {
      sum = (sum + powN(aa, 59 - i, MOD)) % MOD;
    }
  }
  cout << sum << endl;
}
