#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long int INF = 1LL << 56;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
struct edge {
  long long int from, to, cost;
};
long long int gcd(long long int a, long long int b) {
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
int main() {
  long long int n;
  cin >> n;
  long long int a[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int ans = 0, x = 1;
  for (long long int i = 0; i < 61; i++) {
    long long int even = 0, odd = 0;
    for (long long int j = 0; j < n; j++) {
      if (a[j] & (1LL << i))
        odd++;
      else
        even++;
    }
    ans += ((odd % 1000000007) * (even % 1000000007)) * x;
    ans %= 1000000007;
    x *= 2;
    x %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
