#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 50;
int QuickPow(int x, int N) {
  int res = x;
  int ans = 1;
  while (N) {
    if (N & 1) {
      ans = ans * res;
    }
    res = res * res;
    N = N >> 1;
  }
  return ans;
}
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
long long arr[1000000];
int main() {
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long sum = 0;
  for (long long i = 0; i < 60; i++) {
    long long oc = 0, zc = 0;
    for (long long j = 0; j < n; j++) {
      if (arr[j] % 2 == 0) {
        zc++;
      } else {
        oc++;
      }
      arr[j] = arr[j] / 2;
    }
    sum = (sum + (zc * oc) % (long long)1000000007 *
                     ((1 << i) % (long long)1000000007)) %
          (long long)1000000007;
  }
  cout << sum % (long long)1000000007 << endl;
  return 0;
}
