#include <bits/stdc++.h>
using namespace std;
long long a[300007];
int num[300007][67];
long long sum0[67], sum1[67], presolve[67];
const long long mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) {
    long long temp = a[i];
    int cnt = 0;
    while (temp) {
      if (temp & 1) num[i][cnt] = 1;
      ++cnt;
      temp /= 2;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int k = 0; k <= 60; ++k) {
      if (num[i][k] == 0)
        ++sum0[k];
      else
        ++sum1[k];
    }
  }
  long long x = 1;
  presolve[0] = 1;
  for (int i = 1; i <= 60; ++i) {
    x *= 2;
    presolve[i] = x;
  }
  for (int i = 0; i <= 60; ++i) {
    ans += (sum0[i] * sum1[i] % mod) * presolve[i] % mod;
    ans %= mod;
  }
  cout << ans;
  return 0;
}
