#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; };
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; };
long long mod(long long a, long long b) { return (a + b - 1) / b; };
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
  std::fill((T*)array, (T*)(array + N), val);
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
};
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
};
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long(i) = 0; i < (n); i++) cin >> a[i];
  long long res = 0;
  for (long long(i) = 0; i < (60); i++) {
    long long count = 0;
    for (long long(j) = 0; j < (n); j++) {
      if (a[j] & (1LL << i)) count++;
    }
    long long now = (1LL << i) % 1000000007;
    now *= count, now % 1000000007;
    now *= n - count, now %= 1000000007;
    res += now, res %= 1000000007;
  }
  cout << res << endl;
  return 0;
}
