#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigMod(T p, T e, T M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T modInverse(T a, T M) {
  return bigMod(a, M - 2, M);
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  a = abs(a);
  b = abs(b);
  return (a / gcd(a, b)) * b;
}
template <class T>
inline string int2String(T a) {
  ostringstream str;
  str << a;
  return str.str();
}
template <class T>
inline T string2int(string a) {
  stringstream str(a);
  T b;
  str >> b;
  return b;
}
template <class T>
inline void read(T& r) {
  r = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' or ch > '9') {
    f = (ch == '-' ? -1 : 1), ch = getchar();
  }
  while (ch >= '0' and ch <= '9') {
    r = r * 10 + ch - '0', ch = getchar();
  }
  r *= f;
}
long long a[300005];
int main() {
  int n;
  scanf("%d", &n);
  long long x;
  for (int i = int(0); i < int(n); i++) scanf("%lld", &a[i]);
  long long ans = 0;
  for (int i = int(0); i < int(61); i++) {
    int one, zero;
    one = zero = 0;
    for (int j = int(0); j < int(n); j++) {
      if (a[j] % 2 == 0)
        zero++;
      else
        one++;
      a[j] /= 2;
    }
    ans += ((zero * one) % 1000000007 * (1LL << i) % 1000000007) % 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
