#include <bits/stdc++.h>
using namespace std;
long long divide(long long n) {
  if (n % 2 == 1)
    return (n / 2) + 1;
  else
    return n / 2;
}
struct node {
  int binary[60];
} b[300005];
long long a[300005];
long long l[300005], ans[60];
long long maxlen = -1, total = 0;
const int mod = 1e9 + 7;
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++) {
    long long pos = 0, k = a[i];
    while (k != 0) {
      pos++;
      b[i].binary[pos] = k % 2;
      k /= 2;
    }
    for (long long j = 1; j <= divide(pos); j++)
      swap(b[i].binary[j], b[i].binary[pos + 1 - j]);
    l[i] = pos;
  }
  for (long long i = 1; i <= n; i++) {
    if (l[i] > maxlen) maxlen = l[i];
  }
  for (long long i = 1; i <= n; i++) {
    if (l[i] < maxlen) {
      for (long long j = l[i]; j >= 1; j--) {
        b[i].binary[j + maxlen - l[i]] = b[i].binary[j];
        b[i].binary[j] = 0;
      }
    }
  }
  for (int i = 1; i <= maxlen; i++) {
    long long total_1 = 0, total_2 = 0;
    for (int j = 1; j <= n; j++) {
      if (b[j].binary[i] == 0) total_1++;
      if (b[j].binary[i] == 1) total_2++;
    }
    ans[i] = total_1 * total_2;
  }
  long long pos = 1;
  for (long long i = maxlen; i >= 1; i--) {
    total += ans[i] * pos;
    pos = (pos * 2) % mod;
    total %= mod;
  }
  cout << total << endl;
  return 0;
}
