#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
const long long MAX = 100010LL;
template <typename T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <typename T>
T power(T x, T y, long long m = MOD) {
  T ans = 1;
  x %= m;
  while (y > 0) {
    if (y & 1LL) {
      ans = (ans * x) % m;
    }
    y >>= 1LL;
    x = (x * x) % m;
  }
  return (ans % m);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  long long res = 0;
  long long mul = 1;
  for (int k = 0; k < 60; ++k) {
    long long set = 0;
    for (int i = 0; i < n; ++i) {
      if (a[i] & (1ll << k)) {
        ++set;
      }
    }
    res += set * ((n - set) * mul) % MOD;
    res %= MOD;
    mul *= 2;
    mul %= MOD;
  }
  cout << res << "\n";
  return 0;
}
