#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000007;
const long long mod = 1000000007;
const double PI = 3.14159265358979323846;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int cans(bool f) {
  if (f)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
long long A[1000000][60];
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < (N); i++) {
    long long a;
    cin >> a;
    for (int j = 0; j < (60); j++) {
      if (a == 0) break;
      A[i][j] = a % 2;
      a /= 2;
    }
  }
  long long ans = 0;
  for (int i = 0; i < (60); i++) {
    long long a = 0, b = 0;
    for (int j = 0; j < (N); j++) {
      if (A[j][i] == 0)
        a++;
      else
        b++;
    }
    long long mul = pow(2, i);
    mul %= mod;
    ans += (a * b) * mul;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
