#include <bits/stdc++.h>
using namespace std;
const int N = 20;
struct node {
  int x, y;
};
int n, x[2][66], b = 60;
long long ans, t, a[100005];
void cmax(int &a, int b) { a = a > b ? a : b; }
void cmin(int &a, int b) { a = a < b ? a : b; }
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    t = max(t, a[i]);
  }
  while ((t & (1ll << b)) == 0) --b;
  for (register int i = 1; i <= n; ++i)
    for (register int j = 0; j <= b; ++j) ++x[(a[i] & (1ll << j)) ? 1 : 0][j];
  for (register int i = 0; i <= b; ++i)
    cout << x[0][i] << ' ' << x[1][i] << endl;
  for (register int i = 0; i <= b; ++i)
    ans = (ans + (1ll << i) * x[0][i] * x[1][i]) % 1000000007;
  printf("%lld", ans);
  return 0;
}
