#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const long long MXN = 20;
long long power(long long a, long long b) {
  long long res = 1;
  a %= M;
  while (b) {
    if ((b & 1)) res = (res * a) % M;
    a = (a * a) % M;
    b >>= 1;
  }
  return res;
}
inline void print(long long a, long long b) { cout << a << ' ' << b << endl; }
inline void print(long long a, long long b, long long c) {
  cout << a << ' ' << b << ' ' << c << ' ' << endl;
}
long long n;
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  long long a;
  long long b[65];
  memset(b, 0, sizeof(b));
  for (long long i = 0; i < n; ++i) {
    cin >> a;
    for (long long i = 0; i < 61; ++i) {
      b[i] += ((a >> i) & 1LL);
    }
  }
  long long ans = 0, pl = 1;
  for (long long i = 0; i < 61; ++i) {
    long long cnt = b[i] * (n - b[i]) % M;
    (ans += cnt * pl % M) %= M;
    pl *= 2LL;
  }
  cout << ans << endl;
  return 0;
}
