#include <bits/stdc++.h>
using namespace std;
long long exp(long long x, long long y, long long p) {
  long long res = 1;
  while (y) {
    if (y % 2) res = (res * x % p) % p;
    x = (x * x) % p;
    y /= 2;
  }
  return res;
}
long long expm(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y % 2) res = (res * x % ((long long)1e9 + 7)) % ((long long)1e9 + 7);
    x = (x * x) % ((long long)1e9 + 7);
    y /= 2;
  }
  return res;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  {
    long long n;
    cin >> n;
    vector<long long> v(n);
    for (long long i = 0; i < n; i++) {
      cin >> v[i];
    }
    long long ans = 0;
    for (long long j = 0; j <= 60; j++) {
      long long c = 0;
      for (long long i = 0; i < n; i++) {
        if (v[i] & 1) c++;
        v[i] >>= 1;
      }
      ans += c * (n - c) * expm(2, j);
      ans %= ((long long)1e9 + 7);
    }
    cout << ans << "\n";
  }
  return 0;
}
