#include <bits/stdc++.h>
using namespace std;
long long a[300005], ans = 0, one, zero;
int def = 1e9 + 7;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  for (int i = 0; i < 60; i++) {
    long long bit = 1LL << i;
    one = 0, zero = 0;
    for (int j = 1; j <= n; j++) {
      if (a[j] & bit)
        one++;
      else
        zero++;
    }
    ans += bit % def * (one * zero) % def;
  }
  printf("%lld", ans % def);
  return 0;
}
