#include <bits/stdc++.h>
using namespace std;
const long long linf = 1e18;
const int inf = 1001001001;
const long long mod = 1e9 + 7;
const int nax = 3e5 + 7;
int n, msb = 0;
int s[nax], c1[65], c0[65], res[65];
int modpow(int x, int n) {
  if (n == 0) return 1;
  long long u = modpow(x, n / 2);
  u = (u * u) % mod;
  if (n % 2 == 1) u = (u * x) % mod;
  return u;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
    msb = max(msb, 32 - __builtin_clz(s[i]));
  }
  for (int j = 0; j < n; ++j) {
    int a = s[j];
    for (int i = 0; i < msb; ++i) {
      if (a & (1 << i))
        c1[i]++;
      else
        c0[i]++;
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < msb; ++j) {
      if (s[i] & (1 << j)) {
        res[j] += c0[j];
      }
    }
  }
  for (int i = 0; i < msb; ++i) {
    int add = modpow(2, i);
    ans = (long long)(ans +
                      (long long)((long long)add * (long long)res[i]) % mod) %
          mod;
  }
  cout << ans;
  return 0;
}
