#include <bits/stdc++.h>
int main() {
  long MOD = 1000000007L;
  int n;
  scanf("%d", &n);
  int b[n][60];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      b[i][j] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    long a;
    scanf("%ld", &a);
    for (int j = 0; j < 60; j++) {
      b[i][j] = (int)(a % 2);
      a /= 2;
      if (a == 0) break;
    }
  }
  long sum = 0L;
  for (int j = 0; j < 60; j++) {
    long cnt = 0L;
    for (int i = 0; i < n; i++) {
      cnt += b[i][j];
    }
    sum += cnt * (n - cnt) * (long)pow((double)2, (double)j) % MOD;
    sum %= MOD;
  }
  printf("%d", sum);
  return 0;
}
