#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long a[300100];
int main() {
  int n;
  scanf("%d", &n);
  long long ans = 0ll;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  for (long long i = 1; i <= 60; i++) {
    long long c = 0, b = 0;
    for (int j = 1; j <= n; j++) {
      if (a[j] & (1ll << (i - 1ll)))
        c++;
      else
        b++;
    }
    ans = (ans + ((long long)(c * b) % mod * (1ll << (i - 1ll)) % mod) % mod) %
          mod;
  }
  cout << ans;
  return 0;
}
