#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long m, long long mod) {
  long long ans = 1;
  while (m) {
    if (m % 2) {
      ans *= a;
      ans %= (mod);
    }
    a = (a * a) % (mod);
    m >>= 1;
  }
  return ans;
}
void init(long long* a, long long n, long long val) {
  for (long long i = 0; i < n; i++) a[i] = val;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1, i, j;
  long long n;
  cin >> n;
  long long a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long c = 0, k, ans = 0;
  for (j = 0; j < 62; j++) {
    c = 0;
    for (i = 0; i < n; i++) {
      if (a[i] & (long long)pow(2, j)) {
        c++;
      }
    }
    k = c * (n - c);
    ans += ((k * ((long long)pow(2, j) % 1000000007)) % 1000000007);
    ans %= 1000000007;
  }
  cout << ans;
  return 0;
}
