#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void Read(T &n) {
  char ch;
  bool flag = 0;
  while (!isdigit(ch = getchar()))
    if (ch == '-') flag = 1;
  for (n = ch ^ 48; isdigit(ch = getchar());
       n = (n << 1) + (n << 3) + (ch ^ 48))
    ;
  if (flag) n = -n;
}
const long long MOD = 1000000007;
const int MAXN = 300005;
const int MAXK = 60;
long long a[MAXN], num[2], maxi;
int main() {
  int n;
  Read(n);
  for (register int i = 1; i <= n; i++) Read(a[i]), maxi = max(maxi, a[i]);
  long long base = 1, ans = 0;
  while (maxi) {
    num[0] = num[1] = 0;
    for (register int i = 1; i <= n; i++) num[a[i] & 1]++;
    ans += base * num[0] * num[1] % MOD;
    ans %= MOD;
    base = base + base;
    if (base >= MOD) base -= MOD;
    for (register int i = 1; i <= n; i++) a[i] /= 2;
    maxi /= 2;
  }
  cout << ans << endl;
  return 0;
}
